Bridge domain edits to shared universe state#15
Merged
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds support for legacy domain property updates by introducing a dedicated Redux action and reducer logic to merge domain patches into the shared universe state.
Changes:
- Added
setUniverseDomainaction and reducer handling to updateworldDefinition.domain. - Introduced
mergeDomainPatchhelper to shallow-merge domain objects. - Mapped legacy
UPDATE_DOMAIN_PROPERTIESaction to the new shared-universe action viatoSharedUniverseAction, and updated dispatch usage inProject.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| src/sharedUniverse/universeSlice.ts | Adds domain patch merge helper, new action, and reducer branch to update worldDefinition.domain. |
| src/sharedUniverse/legacyDispatch.ts | Maps legacy UPDATE_DOMAIN_PROPERTIES to setUniverseDomain. |
| src/components/loadModelData/ProjectMenuBar.tsx | Removes unused domain local variable. |
| src/components/Project.tsx | Wraps React Redux dispatch with bindLegacyUniverseDispatch to translate legacy actions. |
Comment on lines
+47
to
+63
| const mergeDomainPatch = (domain: unknown, patch: unknown) => { | ||
| if ( | ||
| domain && | ||
| patch && | ||
| typeof domain === 'object' && | ||
| typeof patch === 'object' && | ||
| !Array.isArray(domain) && | ||
| !Array.isArray(patch) | ||
| ) { | ||
| return { | ||
| ...(domain as Record<string, unknown>), | ||
| ...(patch as Record<string, unknown>), | ||
| }; | ||
| } | ||
|
|
||
| return patch; | ||
| }; |
|
|
||
| export const setUniverseState = createAction<SharedUniverseState>('universe/setUniverseState'); | ||
| export const setUniversePhData = createAction<LegacyPhData>('universe/setUniversePhData'); | ||
| export const setUniverseDomain = createAction<unknown>('universe/setUniverseDomain'); |
| ...state.world, | ||
| worldDefinition: { | ||
| ...state.world.worldDefinition, | ||
| domain: mergeDomainPatch(state.world.worldDefinition.domain, action.payload), |
Comment on lines
+21
to
+22
| const rawDispatch = useDispatch(); | ||
| const dispatch = bindLegacyUniverseDispatch(rawDispatch); |
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.
Summary
This follow-up slice keeps the domain migration moving after PR #14.
It bridges
UPDATE_DOMAIN_PROPERTIESthrough the shared universe adapter so edits to project/domain details updatestate.universe.world.worldDefinition.domainas well as the legacyphData.domainreducer path.Changes
setUniverseDomainto the shared universe reducer.UPDATE_DOMAIN_PROPERTIESthroughtoSharedUniverseAction.Projectcomponent dispatch withbindLegacyUniverseDispatchso domain edits reach shared state.props.phData.domainread fromProjectMenuBar.Notes
The legacy reducer still owns compatibility updates to
phData.domain. This PR only ensures the shared universe tree remains synchronized during domain edits.Remaining expected legacy references are compatibility paths in:
src/reducers/reducer.jssrc/components/utils/workspaceUniverseAdapter.tsValidation
npm run buildnpm test/projectloaded successfully onlocalhost:3000, showed the domain UI, and browser console had no errors.