Conversation
|
|
Visit the preview URL for this PR (updated for commit 81bdc35): https://react-kitchen-sink-dev--pr1061-update-storage-465y6khg.web.app (expires Tue, 01 Apr 2025 13:23:53 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: 6267897ade2ba783b6db70a53a60fc3946d625e9 |
evshi
left a comment
There was a problem hiding this comment.
Can you explain what the issue is? This change will add a lot of extra renders.
| const storage = useEnsembleStorage(); | ||
|
|
||
| return useAtomCallback( | ||
| useCallback( | ||
| (get, set, ...args: T) => { | ||
| const applicationContext = get(appAtom); | ||
| const screenContext = get(screenAtom); | ||
| const storage = get(screenStorageAtom); | ||
| const device = get(deviceAtom); |
There was a problem hiding this comment.
This is not right - the reason we use get instead of the hook here is to prevent unnecessary re-renders whenever the storage is changed.
| () => createStorageApi(storageBuffer, setStorage), | ||
| [setStorage, storageBuffer], | ||
| ); | ||
| const storageApi = createStorageApi(storage, setStorage); |
Describe your changes
update ensemble storage to share the values on multiple screens
Screenshots [Optional]
Before:
Screen.Recording.2025-03-25.at.7.02.02.PM.mp4
After:
Screen.Recording.2025-03-25.at.6.53.44.PM.mp4
Issue ticket number and link
Closes #
Checklist before requesting a review
pnpm changeset add