refactor(style-editor): restructure style editor schema handling and …#35355
Conversation
…remove unused hooks - Introduced for normalizing style editor forms. - Updated and to register style editor schemas. - Removed hook and associated tests to streamline the codebase. - Added new types for style editor fields and schemas in . - Updated various components to utilize the new schema handling, improving maintainability and clarity. This refactor enhances the style editor's integration and prepares for future feature expansions.
|
Claude finished @dario-daza's task in 2m 32s —— View job PR Review: Style Editor Schema Refactor
Issues Found1. console.log('styleEditorSchemas', styleEditorSchemas);This fires on every page load. Fix this → 2. Massive hardcoded mock schema ships in production SDK —
// TODO: Replace mock with real endpoint call like:
// GET /api/v1/style-editor/schemas?pageUrl=<url>
return Promise.resolve([{ contentType: 'Activity', sections: [...] }]);This should either: (a) return 3. Mock data contains third-party image URLs — The hardcoded mock references imageURL: 'https://i.ibb.co/cXv3tfYd/Screenshot-2025-12-23-at-11-58-32-AM.png'Any app using this SDK will make cross-origin requests to imgBB on every page load. This is a privacy/reliability concern even as a temporary mock. 4. Feature flag override hardcoded in // TODO: Remove this, only harcoded until the PR that fix is merged
flags[FeaturedFlags.FEATURE_FLAG_UVE_STYLE_EDITOR] = true;This unconditionally enables the style editor regardless of what the backend returns. The feature flag cannot be disabled from the backend. This TODO was supposed to be temporary — what's the tracking issue for removal? 5. JSDoc vs. implementation mismatch in The JSDoc example shows fields as a 2D array ( 6. Suspicious config.inputType = field.inputType as unknown as StyleEditorFieldInputType;
config.placeholder = field.placeholder as unknown as string;These casts indicate real type incompatibilities being papered over. If 7. export function defineStyleEditorSchema(form: StyleEditorForm): StyleEditorFormSchema {
return normalizeForm(form);
}This adds no validation, no unique behavior, nothing. Both 8. The PR deleted 294 lines of tests and replaced them with 12 lines that only test the 9. Checkbox Developers define checkbox options with a { label: 'Bold', key: 'bold' }But the normalization silently converts this to config.options = field.options.map((opt) => ({ label: opt.label, value: opt.key }));Meanwhile, the mock data in 10. ...(styleEditorSchemas && { styleEditorSchemas })
SummaryThe architecture direction is sound — moving schemas to a server-driven single source of truth is the right call. But this PR shouldn't merge until the mock implementation in |
…ernal module - Updated imports across various components to utilize the new internal module for style editor types and schemas. - Removed obsolete imports from the package, streamlining the codebase. - Introduced a new internal module for style editor types, enhancing organization and maintainability. - Adjusted related services and components to align with the new structure, ensuring consistent usage of style editor schemas. This refactor improves clarity and prepares the codebase for future enhancements in the style editor functionality.
…se-content-type-tab-as-single-source-of-truth-for-headless-and-traditional-pages-frontend
…remove unused hooks
This refactor enhances the style editor's integration and prepares for future feature expansions.
2026-04-16.14-21-37.mov
This PR fixes: #35270