Skip to content

fix(style-editor): Now the style editor form is showed in UVE#35497

Merged
KevinDavilaDotCMS merged 4 commits intomainfrom
35270-unify-style-editor-schema-definition-use-content-type-tab-as-single-source-of-truth-for-headless-and-traditional-pages-qa-failed-i
Apr 29, 2026
Merged

fix(style-editor): Now the style editor form is showed in UVE#35497
KevinDavilaDotCMS merged 4 commits intomainfrom
35270-unify-style-editor-schema-definition-use-content-type-tab-as-single-source-of-truth-for-headless-and-traditional-pages-qa-failed-i

Conversation

@KevinDavilaDotCMS
Copy link
Copy Markdown
Member

@KevinDavilaDotCMS KevinDavilaDotCMS commented Apr 28, 2026

2026-04-28.17-35-27.mov
  • Updated tests in and to use instead of for logging warnings.
  • Adjusted the implementation in and to directly call for logging messages related to missing page queries and schema fetch failures.
  • Removed unnecessary imports of from the test files to streamline the codebase.

This change enhances consistency in logging practices across the codebase.

This PR fixes: #35270

This PR fixes: #35270

…PI and utils tests

- Updated tests in  and  to use  instead of  for logging warnings.
- Adjusted the implementation in  and  to directly call  for logging messages related to missing page queries and schema fetch failures.
- Removed unnecessary imports of  from the test files to streamline the codebase.

This change enhances consistency in logging practices across the codebase.
@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Apr 28, 2026

Claude finished @zJaaal's task in 1m 36s —— View job


PR Review

  • Gather context
  • Read changed files
  • Analyze and post review

Core fix is correct. Removing the typeof window === 'undefined' guard in fetchStyleEditorSchemas (utils.ts:283–286) is the right call — the guard was silently preventing schema fetches in SSR/UVE contexts. The function already handles all failure cases gracefully, so this is safe.

The duplicate import removal in page.js is clean.


Issues worth flagging

1. Spy not restored — test leak (page-api.spec.ts:921)

const consolaWarnSpy = jest.spyOn(console, 'warn');
// ... assertions ...
// missing: consolaWarnSpy.mockRestore()

The spy is never torn down with mockRestore(), unlike every other spy introduced in this PR. It stays active and may suppress or misattribute console.warn calls in subsequent tests in this file. Fix this →

2. Stale test description (page-api.spec.ts:875)

it('should omit styleEditorSchemas and log debug when schema endpoint fails', ...

The implementation now logs at warn level, not debug. The description is misleading.

3. Inconsistent logging — partial consola migration

utils.ts now uses raw console.warn, but client.ts and page-api.ts still use consola. Since consola is still a runtime dep, nothing is gained from the partial switch. Either finish the migration or keep consola here too. The doc comment on fetchStyleEditorSchemas even says "failures are silently ignored", which console.warn contradicts (it emits to stderr in Node.js).

4. consola.debugconsole.warn is a severity escalation

For generic/non-auth errors (network timeouts, unexpected 500s), what was a debug-level hint is now a warning. In SSR environments where the schema endpoint may be unavailable or unreachable, this will emit noisy warnings on every page render. If the intent is that these errors should be visible, that's fine — but it contradicts the "silently ignored" docstring and changes observable behavior.


No other issues.

Comment thread core-web/libs/sdk/client/src/lib/client/page/utils.ts
…r handling

- Changed logging from  to  in  and  to improve clarity in error reporting.
- Updated the implementation in  to reflect the same change, ensuring consistent logging practices across the codebase.

This enhances the visibility of non-auth errors and aligns with the recent refactor of logging practices.
…se-content-type-tab-as-single-source-of-truth-for-headless-and-traditional-pages-qa-failed-i
@KevinDavilaDotCMS KevinDavilaDotCMS added this pull request to the merge queue Apr 29, 2026
Merged via the queue into main with commit baa48c7 Apr 29, 2026
28 checks passed
@KevinDavilaDotCMS KevinDavilaDotCMS deleted the 35270-unify-style-editor-schema-definition-use-content-type-tab-as-single-source-of-truth-for-headless-and-traditional-pages-qa-failed-i branch April 29, 2026 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI: Safe To Rollback Area : Frontend PR changes Angular/TypeScript frontend code Area : SDK PR changes SDK libraries

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Unify Style Editor schema definition: use content type tab as single source of truth for headless and traditional pages

4 participants