-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Store callback Output value in persistence storage #3279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
cc6522c
11f94f2
e1327a8
f5068f6
af9bbc7
72cdc37
fc5eea6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -501,46 +501,21 @@ export function prunePersistence(layout, newProps, dispatch) { | |
| depersistedProps = mergeRight(props, update); | ||
| } | ||
|
|
||
| if (finalPersistence) { | ||
| if (finalPersistence && persistenceChanged) { | ||
| const finalStorage = getStore(finalPersistenceType, dispatch); | ||
|
|
||
| if (persistenceChanged) { | ||
| // apply new persistence | ||
| forEach( | ||
| persistedProp => | ||
| modProp( | ||
| getValsKey(id, persistedProp, finalPersistence), | ||
| finalStorage, | ||
| element, | ||
| depersistedProps, | ||
| persistedProp, | ||
| update | ||
| ), | ||
| filter(notInNewProps, finalPersistedProps) | ||
| ); | ||
| } | ||
|
|
||
| // now the main point - clear any edit of a prop that changed | ||
| // note that this is independent of the new prop value. | ||
| const transforms = element.persistenceTransforms || {}; | ||
| for (const propName in newProps) { | ||
| const propTransforms = transforms[propName]; | ||
| if (propTransforms) { | ||
| for (const propPart in propTransforms) { | ||
| finalStorage.removeItem( | ||
| getValsKey( | ||
| id, | ||
| `${propName}.${propPart}`, | ||
| finalPersistence | ||
| ) | ||
| ); | ||
| } | ||
| } else { | ||
| finalStorage.removeItem( | ||
| getValsKey(id, propName, finalPersistence) | ||
| ); | ||
| } | ||
|
Comment on lines
-525
to
-542
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What did this do? It's inclusion/removal doesn't seem to have an effect.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The issue with this code is that it clears the persisted value before the new selection is written via
This is incorrect because what should be persisted is I might need to handle this differently. What do you think? |
||
| } | ||
| // apply new persistence | ||
| forEach( | ||
| persistedProp => | ||
| modProp( | ||
| getValsKey(id, persistedProp, finalPersistence), | ||
| finalStorage, | ||
| element, | ||
| depersistedProps, | ||
| persistedProp, | ||
| update | ||
| ), | ||
| filter(notInNewProps, finalPersistedProps) | ||
| ); | ||
| } | ||
| return persistenceChanged ? mergeRight(newProps, update) : newProps; | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.