Merged
Conversation
Agent-Logs-Url: https://github.com/jumpinjackie/mapguide-react-layout/sessions/8102b27c-8a0c-4902-820d-f0fc6e32d35c Co-authored-by: jumpinjackie <563860+jumpinjackie@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Chore: Migrate from Redux to Redux Toolkit
Chore: Migrate to Redux Toolkit
Apr 5, 2026
Contributor
Bundle Size Report ✅ PASS
Top Changes
Generated by build-size-diff Commit: e2c9f9d |
Contributor
There was a problem hiding this comment.
Pull request overview
Migrates the project’s Redux store setup from the legacy redux + redux-thunk + redux-logger wiring to Redux Toolkit (@reduxjs/toolkit), simplifying store configuration and aligning middleware/devtools integration with RTK conventions.
Changes:
- Replaced manual store creation with RTK
configureStore(including custom middleware ordering and devtools handling). - Replaced
redux-loggerwith a custom RTKMiddlewareimplementation that preserves the existing filtered-action behavior. - Updated Redux-related type imports in app code and tests to use RTK re-exports.
Reviewed changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
package.json |
Adds @reduxjs/toolkit, removes direct redux* deps. |
yarn.lock |
Locks RTK + transitive deps; removes redux-logger/deep-diff; introduces Redux v5 via RTK. |
src/store/configure-store.ts |
Moves store setup to RTK configureStore, customizes default middleware and devtools. |
src/store/logger.ts |
Implements a custom logger middleware and preserves action-type filtering. |
src/actions/defs.ts |
Switches Action type import to RTK re-export. |
src/layouts/hooks.ts |
Switches Dispatch type import to RTK re-export. |
src/components/map-providers/context.tsx |
Updates comment to reflect RTK-enhanced dispatch typing. |
test/store/configure-store.spec.ts |
Updates Store type import to RTK re-export. |
test/store/logger.spec.ts |
Updates test store creation to RTK configureStore. |
test/containers/hooks.spec.tsx |
Updates Store type import to RTK re-export. |
Comments suppressed due to low confidence (1)
test/store/logger.spec.ts:26
- This test exercises the middleware but doesn’t assert that logging happens for non-filtered actions (it only ensures nothing throws). Since
redux-loggerwas replaced with a custom implementation, add at least one assertion (e.g.,console.groupCollapsed/console.logcalled) to prevent silent regressions in the new logger behavior.
it("passes action through and calls stateTransformer and predicate for regular actions", () => {
// Suppress console output during test
const consoleSpy = vi.spyOn(console, "group").mockImplementation(() => {});
const consoleLogSpy = vi.spyOn(console, "log").mockImplementation(() => {});
const consoleGroupCollapsed = vi.spyOn(console, "groupCollapsed").mockImplementation(() => {});
const consoleGroupEnd = vi.spyOn(console, "groupEnd").mockImplementation(() => {});
const store = configureStore({ reducer, middleware: () => [logger] as any });
// Dispatch a non-filtered action type
store.dispatch({ type: "TEST_ACTION", payload: {} });
// No assertion needed - just ensuring predicate and stateTransformer get called
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Owner
|
@copilot There is a whole lot of TS errors. Pls fix: |
…RTK migration Agent-Logs-Url: https://github.com/jumpinjackie/mapguide-react-layout/sessions/9d1ff5b1-44e1-45f5-afcd-5f908c85cafc Co-authored-by: jumpinjackie <563860+jumpinjackie@users.noreply.github.com>
Contributor
Author
... Fixed in commit 8924f57. The root cause was
|
- Introduced sessionWasReused property in IConfigurationReducerState and related interfaces. - Updated configReducer to handle sessionWasReused during initialization. - Modified activateMap thunk to conditionally describe existing maps based on session reuse. - Enhanced tests to verify sessionWasReused behavior in INIT_APP action.
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.
Replaces the legacy
redux+redux-thunk+redux-loggerstack with@reduxjs/toolkit, which bundles all three and adds DevTools integration out of the box.Package changes
@reduxjs/toolkit ^2.11.2redux,redux-thunk,redux-loggersrc/store/configure-store.tsReplaced manual
createStore+compose+applyMiddlewarewiring with RTK'sconfigureStore. Thunk and DevTools are now handled automatically. Serializability and immutability invariant checks are disabled to preserve compatibility with the existing non-serializable Redux state.src/store/logger.tsredux-logger'screateLoggerreplaced with a hand-rolledMiddlewarethat preserves identical filtering behaviour (sameFILTERED_TYPESset) using RTK'sMiddlewaretype.Import updates
ActionandDispatchimports insrc/actions/defs.tsandsrc/layouts/hooks.tsupdated from'redux'→'@reduxjs/toolkit'(re-exported by RTK).Storetype imports in test files.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
storybook.js.org/opt/hostedtoolcache/node/24.14.1/x64/bin/node /opt/hostedtoolcache/node/24.14.1/x64/bin/node /home/REDACTED/work/mapguide-react-layout/mapguide-react-layout/node_modules/.bin/storybook build -c .storybook(dns block)If you need me to access, download, or install something from one of these locations, you can either: