Skip to content

fix(FR-2606): replace global.packageVersion with globalThis.packageVersion in WebUISider#6878

Merged
graphite-app[bot] merged 1 commit intomainfrom
04-21-fix_fr-2606_replace_global.packageversion_with_globalthis.packageversion_in_webuisider
Apr 30, 2026
Merged

fix(FR-2606): replace global.packageVersion with globalThis.packageVersion in WebUISider#6878
graphite-app[bot] merged 1 commit intomainfrom
04-21-fix_fr-2606_replace_global.packageversion_with_globalthis.packageversion_in_webuisider

Conversation

@nowgnuesLee
Copy link
Copy Markdown
Contributor

@nowgnuesLee nowgnuesLee commented Apr 22, 2026

Resolves #6809(FR-2606)

Summary

Runtime error found after logging into the app with the Vite build:

ReferenceError: global is not defined
  at WebUISider (WebUISider.tsx:349:21)

Triggered the error boundary, blanked the sidebar footer area. One-line fix.

Root cause: WebUISider.tsx:349 read global.packageVersion. Under CRA/Webpack, global was auto-aliased to window in browser builds, so the reference worked by coincidence. Vite intentionally leaves global undefined in the browser (nodePolyfills({ globals: { global: false } }) in vite.config.ts), so the same reference now throws.

The value is actually written to globalThis.packageVersion in the root index.html inline script — switching the read site to globalThis matches the writer and works under any bundler.

Verification

  • grep -r 'global\.' react/src → only test-file usages remain (where global === globalThis in node/jsdom env)
  • Started dev server, logged in as admin, confirmed sidebar renders 26.4.0-alpha.0.<buildNumber> with no ReferenceError in console
  • Error boundary no longer activates on the start page

Stack

Logically belongs to FR-2606 (Vite parity work). Sits above the PWA manifest fix.

Copy link
Copy Markdown
Contributor Author

nowgnuesLee commented Apr 22, 2026


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • flow:merge-queue - adds this PR to the back of the merge queue
  • flow:hotfix - for urgent changes, fast-track this PR to the front of the merge queue

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has required the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a Vite-only runtime crash in the sidebar footer by reading injected build metadata from globalThis instead of global, aligning with how the values are written in index.html.

Changes:

  • Replace global.packageVersion with globalThis.packageVersion in WebUISider to avoid ReferenceError: global is not defined under Vite.

@nowgnuesLee nowgnuesLee force-pushed the 04-21-fix_fr-2608_disable_vite-plugin-pwa_auto-manifest_to_preserve_existing_manifest.json branch from 78236e1 to b789f9e Compare April 28, 2026 05:02
@nowgnuesLee nowgnuesLee force-pushed the 04-21-fix_fr-2606_replace_global.packageversion_with_globalthis.packageversion_in_webuisider branch 2 times, most recently from 16f63fd to 47b0844 Compare April 28, 2026 05:15
@nowgnuesLee nowgnuesLee force-pushed the 04-21-fix_fr-2608_disable_vite-plugin-pwa_auto-manifest_to_preserve_existing_manifest.json branch 2 times, most recently from 3aa344c to 9750f0b Compare April 28, 2026 05:19
@nowgnuesLee nowgnuesLee force-pushed the 04-21-fix_fr-2606_replace_global.packageversion_with_globalthis.packageversion_in_webuisider branch from 47b0844 to 71a5bf7 Compare April 28, 2026 05:19
@nowgnuesLee nowgnuesLee force-pushed the 04-21-fix_fr-2606_replace_global.packageversion_with_globalthis.packageversion_in_webuisider branch from 71a5bf7 to fa7e95d Compare April 28, 2026 05:25
@nowgnuesLee nowgnuesLee force-pushed the 04-21-fix_fr-2608_disable_vite-plugin-pwa_auto-manifest_to_preserve_existing_manifest.json branch from 9750f0b to 4b6a570 Compare April 28, 2026 05:25
@nowgnuesLee nowgnuesLee force-pushed the 04-21-fix_fr-2606_replace_global.packageversion_with_globalthis.packageversion_in_webuisider branch from fa7e95d to 5f1405f Compare April 28, 2026 05:28
@nowgnuesLee nowgnuesLee force-pushed the 04-21-fix_fr-2608_disable_vite-plugin-pwa_auto-manifest_to_preserve_existing_manifest.json branch from 4b6a570 to 0bd7009 Compare April 28, 2026 05:28
@yomybaby yomybaby force-pushed the 04-21-fix_fr-2606_replace_global.packageversion_with_globalthis.packageversion_in_webuisider branch from 5f1405f to cdc4e8a Compare April 30, 2026 12:08
@graphite-app
Copy link
Copy Markdown

graphite-app Bot commented Apr 30, 2026

Merge activity

…eVersion` in WebUISider (#6878)

Resolves #6809(FR-2606)

## Summary

Runtime error found after logging into the app with the Vite build:

```
ReferenceError: global is not defined
  at WebUISider (WebUISider.tsx:349:21)
```

Triggered the error boundary, blanked the sidebar footer area. **One-line fix.**

**Root cause**: `WebUISider.tsx:349` read `global.packageVersion`. Under CRA/Webpack, `global` was auto-aliased to `window` in browser builds, so the reference worked by coincidence. Vite intentionally leaves `global` undefined in the browser (`nodePolyfills({ globals: { global: false } })` in `vite.config.ts`), so the same reference now throws.

The value is actually written to `globalThis.packageVersion` in the root `index.html` inline script — switching the read site to `globalThis` matches the writer and works under any bundler.

## Verification

- [x] `grep -r 'global\.' react/src` → only test-file usages remain (where `global === globalThis` in node/jsdom env)
- [x] Started dev server, logged in as admin, confirmed sidebar renders `26.4.0-alpha.0.<buildNumber>` with no `ReferenceError` in console
- [x] Error boundary no longer activates on the start page

## Stack

Logically belongs to FR-2606 (Vite parity work). Sits above the PWA manifest fix.
@graphite-app graphite-app Bot force-pushed the 04-21-fix_fr-2608_disable_vite-plugin-pwa_auto-manifest_to_preserve_existing_manifest.json branch from 7253345 to 7b13055 Compare April 30, 2026 12:17
@graphite-app graphite-app Bot force-pushed the 04-21-fix_fr-2606_replace_global.packageversion_with_globalthis.packageversion_in_webuisider branch from cdc4e8a to 6683df9 Compare April 30, 2026 12:17
Base automatically changed from 04-21-fix_fr-2608_disable_vite-plugin-pwa_auto-manifest_to_preserve_existing_manifest.json to main April 30, 2026 12:32
@graphite-app graphite-app Bot merged commit 6683df9 into main Apr 30, 2026
7 of 8 checks passed
@graphite-app graphite-app Bot deleted the 04-21-fix_fr-2606_replace_global.packageversion_with_globalthis.packageversion_in_webuisider branch April 30, 2026 12:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS ~10 LoC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Vite PoC Phase 1: dev server + HMR parity for react/ and backend.ai-ui

2 participants