Skip to content

Skip de-arrayification if connecting to a MapGuide Open Source 4.0+ server#1649

Merged
jumpinjackie merged 3 commits into
masterfrom
feature/skip-dearrayification
May 18, 2026
Merged

Skip de-arrayification if connecting to a MapGuide Open Source 4.0+ server#1649
jumpinjackie merged 3 commits into
masterfrom
feature/skip-dearrayification

Conversation

@jumpinjackie
Copy link
Copy Markdown
Owner

This pull request introduces several important improvements to the handling of MapAgent API responses and UI widget processing, as well as updates to related test snapshots. The changes focus on supporting "clean" resource content for newer site versions, improving type detection for UI widgets, and ensuring better compatibility and consistency in the application's Redux state and UI conversion logic.

MapAgent API Enhancements:

  • Added logic to detect site version and use the "clean" resource content API for ApplicationDefinition resources when supported (MapGuide 4.0+), which simplifies resource parsing and improves future compatibility. [1] [2] [3]
  • Implemented a cache for site version lookups to avoid redundant network requests and improve performance.
  • Refactored createRuntimeMap_v4 and describeRuntimeMap_v4 to use the clean API and extract the relevant JSON payload, ensuring more reliable and predictable data structures. [1] [2]

UI Widget Handling Improvements:

  • Enhanced the isUIWidget type guard to recognize widgets using either the WidgetType property or the @xsi:type property, increasing compatibility with various widget definitions.
  • Made widget conversion logic more robust by handling cases where the items array may be undefined, preventing runtime errors.

Test and Redux State Updates:

  • Updated Redux baseline state and snapshot tests to reflect the new clean resource content handling, removal of unnecessary undefined properties, and normalization of flyout and toolbar IDs for consistency between legacy and clean app definitions. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14]

These changes improve maintainability, compatibility with future MapGuide versions, and the reliability of UI and state initialization logic.

Fixes #217

- Updated snapshot test description for clarity.
- Introduced normalization functions to handle pre-de-arrayified app definitions.
- Created a new utility function to canonicalize state for comparison.
- Modified the test to dispatch and compare states from both legacy and clean app definitions.
- Ensured that the redux state produced from both app definitions matches.
- Adjusted mock expectations for site version and runtime map creation calls.
@github-actions
Copy link
Copy Markdown
Contributor

Bundle Size Report ✅ PASS

Metric Size Gzip Brotli
Total 10.21 MB 2.28 MB 1.63 MB
Diff +4.83 KB 🔴 ↑ +770.00 B 🔴 ↑ +659.00 B 🔴 ↑
Change +0.05% +0.03% +0.04%

Top Changes

File Before After Diff
~ viewer-debug.js 200.94 KB 201.30 KB +373.00 B 🔴 ↑
~ viewer.js 122.88 KB 123.16 KB +286.00 B 🔴 ↑

Generated by build-size-diff Commit: 874073c

@coveralls
Copy link
Copy Markdown

Coverage Status

coverage: 60.795% (+0.3%) from 60.531% — feature/skip-dearrayification into master

@jumpinjackie jumpinjackie merged commit 44e26a5 into master May 18, 2026
5 checks passed
@jumpinjackie jumpinjackie deleted the feature/skip-dearrayification branch May 18, 2026 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Skip de-arrayification if connecting to a MapGuide Open Source 3.3 (or newer) server

2 participants