feat(flow-designer): localize palette headings + cloud-sync recents + guide#2553
Merged
Conversation
… guide (#1943) Three follow-ups to the add-node palette search (#1943 / #2543): 1. Localize the palette section headings (Data / Logic / Human / Integration / Flow) to the active console language via five new engine.flowPalette.category.* keys (en + zh). The NodeCategory literals stay English — they remain the in-memory bucket keys / render order tokens; only the CommandGroup heading is translated. 2. Cloud-sync the 'Recently used' list. New FlowPaletteRecentsProvider / useFlowPaletteRecents persist a per-user MRU of node types to sys_user_preference (key ui.flow.palette.recents) via the existing createObjectStackUserStateAdapter stack, mirroring RecentItemsProvider: localStorage-first, debounced write-through, cross-tab sync, silent offline degrade. A one-shot migration folds the legacy unscoped 'flow-palette-recents' key into the signed-in user's scoped list. NodePalette consumes the hook, which falls back to the localStorage module outside a provider (tests, the dev preview gallery), so the pre-cloud-sync behavior is preserved. 3. Add a Flow Designer guide (content/docs/guide/flow-designer.md, registered in guide/meta.json) covering the canvas, the searchable palette (search / keyboard / recents / server-merged plugin nodes), the inspector, and validation/simulation. Extend user-state-persistence.md with the new provider/hook/cap. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011j35dppNPaEp1ULzHoUxYn
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
✅ Console Performance Budget
📦 Bundle Size Report
Size Limits
|
os-zhuang
marked this pull request as ready for review
July 16, 2026 02:26
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.
Three follow-ups to the add-node palette search (#1943, shipped in #2543). Each is independent; grouped here as one cohesive PR since they share the palette surface.
1. Localize the category headings
The palette's section headings (
Data / Logic / Human / Integration / Flow) rendered as hardcoded English while the same popover's search placeholder / empty state / "Recently used" heading were already localized. Now translated via five newengine.flowPalette.category.*keys (en + zh) — e.g. 数据 / 逻辑 / 人工 / 集成 / 流程.The
NodeCategoryliterals,NODE_CATEGORY_ORDER, andnodeCategory()returns are unchanged — they're the in-memory bucket keys / render-order tokens / React keys (not persisted, never sent to the server). Only theCommandGroup headingrender is translated, so bucketing and the server-merge are untouched.2. Cloud-sync the "Recently used" list
Upgrades the MRU from browser-local storage to per-user cloud sync, reusing the existing
sys_user_preferencestack:FlowPaletteRecentsProvider/useFlowPaletteRecents()(context/), modeled onRecentItemsProvider: localStorage-first for instant paint, hydrates from aUserDataAdapter<string>when attached, debounced write-through, cross-tab sync, silent offline degrade. Cap 5.ConsoleShell'sUserStateBridge(newui.flow.palette.recentskey viacreateObjectStackUserStateAdapter) and provider stack; newUserStateKind'flowPaletteRecents'.flow-palette-recentskey (the localStorage-only version) into the signed-in user's scoped list, then removes it.NodePaletteconsumes the hook, which falls back to the localStorage module outside a provider (unit tests, the dev preview gallery) — so the pre-cloud-sync behavior is preserved with no provider wiring.flowPaletteRecents.tsis kept as that fallback + the migration source.3. Flow Designer guide
New
content/docs/guide/flow-designer.md(registered inguide/meta.json) covering the canvas, the searchable palette (search / keyboard / recents / server-merged plugin nodes), the node inspector, and validation/simulation.user-state-persistence.mdextended with the new provider/hook/cap.Testing
NodePalette.test.tsx(13 cases): added a zh-locale test asserting localized headings render and the English literals are gone; existing cases stay green (recents run through the hook's localStorage fallback).FlowPaletteRecentsProvider.test.tsx(8 cases): sync localStorage hydration, dedup-to-front, cap 5, user-scoped persistence, legacy-key migration + clear, adapter hydration overriding local, debouncedsave(), and the no-provider fallback.pnpm vitest run packages/app-shell/src/context packages/app-shell/src/views/metadata-admin/previews→ 247 passed.turbo run build --filter=@object-ui/app-shell(tsc, 29 pkgs) passes; eslint on touched files: 0 errors.apps/sitenext buildexits 0 and generatesdocs/guide/flow-designer;meta.jsonvalid./preview-gallery.html?only=flow+ Playwright): category headings render, ArrowDown+Enter inserts a node, reopen shows "Recently used" with the freshly-inserted type (fallback path), query resets,scrfilter works. Only console errors are the palette'sGET /api/v1/automation/actionsfetch failing with no backend — the expected offline-fallback path, not from the new hook/provider.Note:
turbo run build --filter=@object-ui/sitesurfaces pre-existingtscerrors inplugin-form/plugin-grid/plugin-view(files untouched here, identical tomain) under this worktree's type resolution; the site's ownnext buildpasses. Unrelated to this change.🤖 Generated with Claude Code
https://claude.ai/code/session_011j35dppNPaEp1ULzHoUxYn
Generated by Claude Code