-
-
Notifications
You must be signed in to change notification settings - Fork 210
Enable real-time multi-user sync for local token storage #3630
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
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: d481b33 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
Co-authored-by: six7 <4548309+six7@users.noreply.github.com>
Co-authored-by: six7 <4548309+six7@users.noreply.github.com>
Co-authored-by: six7 <4548309+six7@users.noreply.github.com>
|
|
|
Commit SHA:6d0d29693f8f48ae5d2e2792e1e34c2f5776e336 Test coverage results 🧪
|
|
Commit SHA:6d0d29693f8f48ae5d2e2792e1e34c2f5776e336 |
Problem
When multiple users work on tokens in the same Figma file, changes made by one user are not visible to others until they manually restart the plugin. This leads to:
Solution
This PR implements automatic real-time synchronization for local token storage by leveraging Figma's native
documentchangeevent system. When any user modifies tokens, all other users with the plugin open automatically receive and display the updates.How it works
documentchangeevents for remote modifications to token-related shared plugin dataTOKEN_DATA_CHANGEDmessage to the UI with the updated timestampRELOAD_TOKEN_DATAmessageKey Features
Technical Implementation
New Message Types:
TOKEN_DATA_CHANGED(plugin → UI): Notifies UI of remote token modificationsRELOAD_TOKEN_DATA(UI → plugin): Requests fresh token data from storageModified Files:
sendDocumentChange.ts: Enhanced to detect and notify about token data changesAppContainer.tsx: Added useEffect listener for automatic token reloadAsyncMessages.ts: Added new message type definitionsreloadTokenData.ts,tokenDataChanged.tsSafeguards:
origin: 'REMOTE'(from other users)Limitations
Testing
Documentation
Comprehensive documentation added in
docs/REAL_TIME_SYNC.mdexplaining:Closes: Addresses the need for multi-user real-time collaboration on tokens within the same Figma file.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.