Skip to content

chore: silent css variable warning for SSR#539

Merged
Brentlok merged 2 commits into
mainfrom
silent-css-variable-warnings-ssr
May 18, 2026
Merged

chore: silent css variable warning for SSR#539
Brentlok merged 2 commits into
mainfrom
silent-css-variable-warnings-ssr

Conversation

@Brentlok

@Brentlok Brentlok commented May 18, 2026

Copy link
Copy Markdown
Contributor

fix #537

Summary by CodeRabbit

  • Bug Fixes
    • Suppressed development-only console warnings that appeared during server-side rendering on web platforms when browser globals are unavailable.
    • Confirmed CSS variable lookup and subscription/update behavior remain unchanged, ensuring runtime behavior is unaffected while reducing noisy dev logs.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 18, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e6a5d5e8-62a4-41ef-ab5d-28df99939f75

📥 Commits

Reviewing files that changed from the base of the PR and between 5777f97 and 93cf9ec.

📒 Files selected for processing (1)
  • packages/uniwind/src/hooks/useCSSVariable/useCSSVariable.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/uniwind/src/hooks/useCSSVariable/useCSSVariable.ts

📝 Walkthrough

Walkthrough

The useCSSVariable hook now imports Platform and adds a development-only early return in logDevError to suppress missing-CSS-variable warnings during web SSR when document or window are unavailable. No runtime lookup or subscription behavior changed.

Changes

SSR Warning Suppression

Layer / File(s) Summary
SSR-aware warning suppression in useCSSVariable
packages/uniwind/src/hooks/useCSSVariable/useCSSVariable.ts
Adds Platform import and modifies logDevError to return early in development on web when document/window are missing, preventing SSR warning logs about missing CSS variables.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • uni-stack/uniwind#521: Both PRs modify the useCSSVariable hook's warning logic; this PR adds SSR suppression while that PR refactored the warning handling.

Poem

🐰 I hop through code with a careful eye,
On server-side web where no windows lie,
I hush the warnings that spring from the night,
So CSS variables sleep without a fright. 🥕

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'chore: silent css variable warning for SSR' accurately describes the main change: suppressing CSS variable warnings during server-side rendering.
Linked Issues check ✅ Passed The PR addresses issue #537 by adding early return logic to suppress false-positive warnings when document/window are unavailable during SSR, directly matching the stated objective.
Out of Scope Changes check ✅ Passed Changes are limited to silencing SSR warnings in useCSSVariable without altering variable lookup or subscription behavior, remaining fully within scope of the linked issue.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch silent-css-variable-warnings-ssr

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Brentlok Brentlok merged commit 78ab1a3 into main May 18, 2026
2 checks passed
@Brentlok Brentlok deleted the silent-css-variable-warnings-ssr branch May 18, 2026 07:40
@github-actions

Copy link
Copy Markdown
Contributor

🚀 This pull request is included in v1.7.0. See Release v1.7.0 for release notes.

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.

[Web] Static Theme - useCSSVariable - We couldn't find your variable during SSR

1 participant