Repository navigation
Conversation
Add a future option to createMapsightStore and forward it from the ui future flags as v8_unsetRemovesKey. With the flag on, unset(path) deletes the key of a plain object parent; array elements, missing parents and a plain set(path, undefined) keep their behavior.
🦋 Changeset detectedLatest commit: d36e9e0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This branch has not been deployed
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
Stacked on #478 (
feat/remove-layer-and-feature-source); merge that one first. The diff here shows only the flag.unset(path)isset(path, undefined): the key stays in the state with anundefinedvalue. That state does not survive serialisation and contradicts the state types. In the next major of@mapsight/core,unsetwill delete the key. Until then the default stays as it is, and hosts can opt in per store.@mapsight/core:createMapsightStoretakes afutureoption with the contract of Decision 012 (v{major}_{behavior},truemeans the next major's behaviour now). New flagv15_unsetRemovesKey. With it on,unset(path)deletes the key when its parent is a plain object, with the same result asremoveKey. Array elements are still set toundefined, a missing key or parent leaves the state reference unchanged, and a plainset(path, undefined)behaves as before. Without the flag nothing changes.unsetis still aMAPSIGHT_SETaction, now with a marker inmeta. The flag is read per store, in the reducercreateMapsightStorebuilds for each controller after path routing; only anunsetwith a plain-object parent is turned intoremoveKey. Batches and thecontrolled(),quiet()andasync()wrappers keep the marker. Several stores on one page can use different settings.@mapsight/ui:createOptions.future.v8_unsetRemovesKeyis forwarded to the core flag. The name follows the ui major line, as Decision 012 prescribes forcreateOptions; it assumes ui v8 ships together with core v15.futureoption with the same contract), the config reference, the action guide with a table of both modes, the Redux architecture and config merge notes. They recommendremoveKeyand the domain actions for removal today.Note for reviewers: with the flag on, reducers registered on a controller see
MAPSIGHT_REMOVE_KEYinstead ofMAPSIGHT_SETfor such anunset; app reducers still see the original action.Test plan
pnpm --filter @mapsight/core test(385 tests),typecheck,lint(no errors)pnpm --filter @mapsight/ui test(584 tests),typecheck,lint(no errors)pnpm run check{},false): results pinned againstset(path, undefined), including state reference equalityunsetinside a batch and wrapped incontrolled(),quiet()andasync(); two stores with different settingsremoveInteractionSelectionin both modes;unsetof a layer or feature source ends in the same state asremoveLayer/removeFeatureSource