You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "rusackas (via GitHub)" <gi...@apache.org> on 2026/02/24 01:22:14 UTC
[PR] fix(docs): guard window reference in logging.ts for SSR compatibility [superset]
rusackas opened a new pull request, #38201:
URL: https://github.com/apache/superset/pull/38201
### SUMMARY
Fixes the Netlify docs build failure (`window is not defined`) that's been breaking deploy previews on all PRs.
**Root cause:** `superset-frontend/packages/superset-core/src/utils/logging.ts` references `window.console` at module initialization with no SSR guard. During Docusaurus SSG, this module gets evaluated in Node.js via the import chain:
```
alert.mdx → StorybookWrapper → @apache-superset/core/ui → Alert → translation → Translator → logging.ts
↑
window.console (💥 in Node.js)
```
**Fix:** Add a `typeof window !== 'undefined'` guard with `globalThis.console` fallback for Node.js.
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
**Before:** Every PR's Netlify deploy preview fails with:
```
Error: Can't render static file for pathname "/developer_portal/extensions/components/alert"
ReferenceError: window is not defined
```
**After:** SSG renders the page successfully with Node.js `globalThis.console` as fallback.
### TESTING INSTRUCTIONS
1. Build the docs site:
```bash
cd docs
npm install
npm run build
```
2. Verify the build completes without `window is not defined` errors
3. Verify `/developer_portal/extensions/components/alert` renders correctly in the build output
### ADDITIONAL INFORMATION
- [ ] Has associated issue:
- [ ] Required feature flags:
- [ ] Changes UI
- [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
- [ ] Migration is atomic, supports rollback & is backwards-compatible
- [ ] Confirm DB migration upgrade and downgrade tested
- [ ] Runtime estimates and downtime expectations provided
- [ ] Introduces new feature or API
- [ ] Removes existing feature or API
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(docs): guard window reference in logging.ts for SSR compatibility [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #38201:
URL: https://github.com/apache/superset/pull/38201#issuecomment-3948331885
AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(docs): guard window reference in logging.ts for SSR compatibility [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #38201:
URL: https://github.com/apache/superset/pull/38201#issuecomment-3948362882
<div>
<h3>Code Review Agent Run #4601b3</h3>
<div>
<details>
<summary>
<b>Actionable Suggestions - 0</b>
</summary>
</details>
</div>
<div>
<details>
<summary>
<b>Review Details</b>
</summary>
<ul>
<li>
<div id="file_reviewed">
Files reviewed - <b>1</b> · Commit Range: <code>2c9a943..2c9a943</code>
<ul>
<li>superset-frontend/packages/superset-core/src/utils/logging.ts</li>
</ul>
</div>
</li>
<li>
<div id="file_skipped">
Files skipped - <b>0</b>
<ul>
</ul>
</div>
</li>
<li>
<div id="tools">
Tools
<ul>
<li><b>Whispers</b> (Secret Scanner) - ✔︎ Successful</li><li><b>Detect-secrets</b> (Secret Scanner) - ✔︎ Successful</li><li><b>Eslint</b> (Linter) - ✔︎ Successful</li>
</ul>
</div>
</li>
</ul>
</details>
</div>
<hr>
<details>
<summary>
<b>Bito Usage Guide</b>
</summary>
**Commands**
Type the following command in the pull request comment and save the comment.
- `/review` - Manually triggers a full AI review.
- `/pause` - Pauses automatic reviews on this pull request.
- `/resume` - Resumes automatic reviews.
- `/resolve` - Marks all Bito-posted review comments as resolved.
- `/abort` - Cancels all in-progress reviews.
Refer to the <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/available-commands" target="_blank" rel="noopener noreferrer">documentation</a> for additional commands.
**Configuration**
This repository uses `Superset` You can customize the agent settings <a href="https://alpha.bito.ai/home/ai-agents/code-review-agent" target="_blank" rel="noopener noreferrer">here</a> or contact your Bito workspace admin at evan@preset.io.
**Documentation & Help**
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/getting-started/install-run-using-bito-cloud/create-or-customize-an-agent-instance" target="_blank" rel="noopener noreferrer">Customize agent settings</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/implementing-custom-code-review-rules" target="_blank" rel="noopener noreferrer">Review rules</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent" target="_blank" rel="noopener noreferrer">General documentation</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/faqs" target="_blank" rel="noopener noreferrer">FAQ</a>
</details>
<span><i>AI Code Review powered by</i> <sub><sub><a href="https://bito.ai/" target="_blank"><img src="https://bito.ai/wp-content/uploads/2023/10/Logo-Bito-Black-cropped.svg" alt="Bito Logo" width="50" height="20" /></a></sub></sub></span>
</div>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(docs): guard window reference in logging.ts for SSR compatibility [superset]
Posted by "codeant-ai-for-open-source[bot] (via GitHub)" <gi...@apache.org>.
codeant-ai-for-open-source[bot] commented on PR #38201:
URL: https://github.com/apache/superset/pull/38201#issuecomment-3948334737
## **Sequence Diagram**
Shows the import/evaluation path during Docusaurus SSG that previously accessed window.console at module init (causing "window is not defined"), and the updated logging.ts which now guards the window check and falls back to globalThis.console so the SSG can proceed.
```mermaid
sequenceDiagram
participant SSG (Node)
participant AlertModule
participant Translator
participant LoggingModule
participant Console (globalThis)
SSG (Node)->>AlertModule: import Alert (SSG build)
AlertModule->>Translator: import translation → Translator
Translator->>LoggingModule: import Logger (module evaluated)
LoggingModule->>Console: typeof window !== 'undefined' ? window.console : globalThis.console
Console-->>LoggingModule: return console API (fallback to globalThis in Node)
LoggingModule-->>SSG (Node): export logger (safe for SSR)
SSG (Node)-->>AlertModule: continue static render with logger
```
---
*Generated by [CodeAnt AI](https://codeant.ai)*
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(docs): guard window reference in logging.ts for SSR compatibility [superset]
Posted by "netlify[bot] (via GitHub)" <gi...@apache.org>.
netlify[bot] commented on PR #38201:
URL: https://github.com/apache/superset/pull/38201#issuecomment-3948337252
### <span aria-hidden="true">✅</span> Deploy Preview for *superset-docs-preview* ready!
| Name | Link |
|:-:|------------------------|
|<span aria-hidden="true">🔨</span> Latest commit | 2c9a9439871fca2b5447f1f5896047f261b2c1af |
|<span aria-hidden="true">🔍</span> Latest deploy log | https://app.netlify.com/projects/superset-docs-preview/deploys/699cfd47a7db160008edd6b6 |
|<span aria-hidden="true">😎</span> Deploy Preview | [https://deploy-preview-38201--superset-docs-preview.netlify.app](https://deploy-preview-38201--superset-docs-preview.netlify.app) |
|<span aria-hidden="true">📱</span> Preview on mobile | <details><summary> Toggle QR Code... </summary><br /><br /><br /><br />_Use your smartphone camera to open QR code link._</details> |
---
<!-- [superset-docs-preview Preview](https://deploy-preview-38201--superset-docs-preview.netlify.app) -->
_To edit notification comments on pull requests, go to your [Netlify project configuration](https://app.netlify.com/projects/superset-docs-preview/configuration/notifications#deploy-notifications)._
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(docs): guard window reference in logging.ts for SSR compatibility [superset]
Posted by "villebro (via GitHub)" <gi...@apache.org>.
villebro merged PR #38201:
URL: https://github.com/apache/superset/pull/38201
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org