feat(figma): mint stable file id from root pluginData instead of figma.fileKey#76
Open
piaskowyk wants to merge 2 commits into
Open
feat(figma): mint stable file id from root pluginData instead of figma.fileKey#76piaskowyk wants to merge 2 commits into
piaskowyk wants to merge 2 commits into
Conversation
…a.fileKey `figma.fileKey` requires the private plugin API (`enablePrivatePluginApi`), which blocks a public Figma Community release. It was the only private API in use — everything else is standard. Replace it with a per-document id minted on first use and persisted in the document's root pluginData. Root pluginData is stored in the file and synced to every collaborator, so the key is just as stable and shared as fileKey was; it only lives in our own namespace, which is fine since it just keys our own server rows. Flip `enablePrivatePluginApi` to false so the plugin can be published publicly. `fileKeyOverride` is retained as a secondary fallback. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Rationale now lives in the PR description instead of inline. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Why
figma.fileKeyis gated behind the private plugin API (enablePrivatePluginApi: true), and a plugin with that flag set cannot be published publicly to the Figma Community — only as an org-private plugin. It was the only private API the plugin used; everything else (clientStorage,currentPage,getNodeByIdAsync,findAllWithCriteria,viewport,openExternal,notify, etc.) is standard public API.What
resolveFileKey()in the main thread: reads a stable id from the document's root pluginData, minting and persisting one on first use.figma.fileKey ?? nullreads (init,request-preview-data) forresolveFileKey().enablePrivatePluginApi→falseinmanifest.json.Root pluginData is stored in the file and syncs to every collaborator, so the key is just as stable and shared as
fileKeywas — it just lives in our own namespace instead of Figma's global one, which is fine since it only keys our own preview-server rows.fileKeyOverrideis retained as a secondary fallback.Notes
figma.fileKeywill mint a fresh id and create a new server row on first open — acceptable at this stage.npm run typecheckandnpm run buildboth pass.🤖 Generated with Claude Code