Dispatchable init action#1648
Merged
Merged
Conversation
- Replaced the `initLayout` command with `fetchInitDocument` and `initAppFromDocument` in the App component. - Updated the `IInitAppLayout` interface to accommodate `WebLayout` alongside `ApplicationDefinition`. - Enhanced error handling by exporting `processAndDispatchInitError`. - Removed the `IViewerInitCommand` dependency from various components and tests. - Adjusted tests to reflect changes in initialization logic and ensure proper mocking of new functions. - Cleaned up imports and unused code related to the old initialization command.
Contributor
Bundle Size Report ✅ PASS
Top Changes
Generated by build-size-diff Commit: 48b90a6 |
…edux state - Implemented a new test file `init-dispatchable.spec.ts` to test the `initAppFromDocument` action. - Created a mock client to simulate API interactions. - Added a snapshot file `init-dispatchable.spec.ts.snap` to capture the expected redux baseline state after dispatching the action. - Ensured the legacy app definition is correctly de-arrayified and integrated into the redux store.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request refactors the viewer initialization logic for MapGuide React Layout, dissolving the
DefaultViewerInitCommandclass and replacing it with a set of module-level free functions. This change simplifies the codebase, eliminates unnecessary class structure and circular dependencies, and clarifies the separation of responsibilities in the initialization process. The documentation is updated to reflect these architectural changes, and several utility and initialization functions are now exported directly for reuse.Codebase Simplification and Refactoring
DefaultViewerInitCommandclass and its abstract base, along with related interfaces, in favor of free functions for the init payload stage (src/actions/init-command.ts,src/actions/init-mapguide.ts). [1] [2] [3]isArbitraryCoordSys,establishInitialMapNameAndSession,initLocaleAsync, andinitFromAppDefCoreAsync, making dependencies explicit and removing vestigial extension points. [1] [2] [3] [4]Documentation and Guidance Updates
DefaultViewerInitCommand, including rejected alternatives and the resulting architectural improvements (docs/adr/0001-dissolve-default-viewer-init-command.md)..github/copilot-instructions.mdto clarify import practices, especially prohibitingawait import(...)inside functions, and to reinforce static import usage.CONTEXT.md) describing the terminology and relationships in the viewer initialization flow, clarifying ambiguous terms and documenting the new functional structure.Export and Utility Function Improvements
getExtraProjectionsFromFlexLayout,parseSwipePairs) to be exported directly for use in the new functional initialization pipeline. [1] [2]These changes collectively modernize the initialization architecture, improve maintainability, and provide clearer documentation for future development.
Fixes #1335