Skip to content

fix(figma): stop stuck saves and sync prefixed names to builders - #39

Draft
DavidBabinec wants to merge 1 commit into
mainfrom
fix/figma-save-loading-and-prefixes
Draft

DavidBabinec wants to merge 1 commit into
mainfrom
fix/figma-save-loading-and-prefixes

Conversation

@DavidBabinec

Copy link
Copy Markdown
Contributor

What

Saving from the Figma plugin to WordPress could leave the save spinner running forever, end with no message when WordPress rejected a write, and send Bricks and Oxygen unprefixed class names and color variables on projects with a class or variable prefix.

Why

syncWp had no try/finally, so any throw in the writes or the builder sync skipped setIsLoading(false), and a falsy write fell through silently. It now catches, shows an error toast, and always clears loading. usePushFigmaSync called the classes and colors refresh without the prefixes that packages/wp/src/hooks/usePush.ts passes from preset.classPrefix and preset.variablePrefix; it now passes both.

Verification

New hook tests fail on main (6 of 7) and pass with the fix.

bun run test:www            # 27 suites, 163 passed
bun run build:www / build:figma / build:wp   # exit 0
bun run check:open-source   # passed
biome check (touched files) # no fixes

Notes

Not driven inside Figma Desktop against a live WordPress site; the save path only runs in that host.

The WordPress save from the Figma plugin had no try/finally, so a throw in
the writes or the builder sync left the save spinner running, and a falsy
write ended the save with no message. The builder sync also dropped the
project's class and variable prefixes that the WordPress-side save passes,
so prefixed projects sent unprefixed classes and color variables to Bricks
and Oxygen.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant