Repository navigation
fix(studio): trust the server format catalog - #2038
Conversation
|
Someone is attempting to deploy a commit to the Rohan Verma's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
What
Use the Studio format catalog returned by the API as the authoritative list once it has loaded. The existing local catalog remains the pre-load fallback; unknown server formats use the established label, icon, tooltip, and viewer fallbacks.
The regression test verifies server order, an unknown format, its availability reason, and removal of a frontend-only format. The Studio architecture document now describes that contract and removes the resolved known gap.
This PR was implemented and reviewed by an AI coding assistant. No independent human review is claimed.
Why
The previous merge iterated only the hard-coded frontend keys, so a backend format was silently omitted until the frontend duplicated its key. It also kept offering formats the server did not return.
Fixes #2002
How to test
pnpm exec vitest run --environment jsdom src/features/studio/studio-panel.test.tsx(7 passed)pnpm test(301 passed)pnpm typecheckpnpm exec eslint src/features/studio/studio-panel.tsx src/features/studio/studio-panel.test.tsxpnpm exec prettier --check src/features/studio/studio-panel.tsx src/features/studio/studio-panel.test.tsxpython scripts/check_docs.py(97 files, 0 problems)High-level PR Summary
This PR fixes a bug where the Studio format picker was only showing formats hard-coded in the frontend, causing server-side formats to be silently omitted. The fix makes the API's format catalog the authoritative source once loaded, while keeping the local catalog as a pre-load fallback. The change ensures server-defined formats appear in the correct order, unknown formats are handled gracefully with default UI elements, and formats not returned by the server are properly removed from the picker.
⏱️ Estimated Review Time: 5-15 minutes
💡 Review Order Suggestion
surfsense_local/frontend/src/features/studio/studio-panel.tsxsurfsense_local/frontend/src/features/studio/studio-panel.test.tsxdocs/architecture/studio.md