Skip to content

chore: Remove CDN loading for the Monaco editor in all environments - #47182

Merged
ivasilov merged 5 commits into
masterfrom
ivan/fe-2606-remove-cdnjs-monaco-css-edge-case-in-studio
Jun 30, 2026
Merged

ivasilov merged 5 commits into
masterfrom
ivan/fe-2606-remove-cdnjs-monaco-css-edge-case-in-studio

Conversation

@ivasilov

@ivasilov ivasilov commented Jun 22, 2026 •

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • Chores
    • Standardized Monaco Editor package versions across the workspace using the shared dependency catalog.
  • Bug Fixes
    • Improved Monaco initialization by configuring asset loading only on the client and serving Monaco assets from a single base-path URL (removing platform-specific switching).
    • Streamlined Monaco stylesheet injection in Studio’s document rendering.
  • New Features
    • Added/updated Monaco language support in Studio, including GraphQL, SQL, and PostgreSQL, with refreshed HTML, JSON, and CSS editor modes.

@supabase

supabase Bot commented Jun 22, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project xguihxuzqibwxjnimxev because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@coderabbitai

coderabbitai Bot commented Jun 22, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 6b293804-f0af-4268-87ed-90cd32bdba47

📥 Commits

Reviewing files that changed from the base of the PR and between c14bad5 and 3fa3045.

⛔ Files ignored due to path filters (1)
  • apps/studio/public/monaco-editor/vs/base/browser/ui/codicons/codicon/codicon.ttf is excluded by !**/*.ttf
📒 Files selected for processing (32)
  • apps/studio/package.json
  • apps/studio/pages/_app.tsx
  • apps/studio/pages/_document.tsx
  • apps/studio/public/monaco-editor/base/common/worker/simpleWorker.nls.js
  • apps/studio/public/monaco-editor/base/worker/workerMain.js
  • apps/studio/public/monaco-editor/basic-languages/html/html.js
  • apps/studio/public/monaco-editor/basic-languages/pgsql/pgsql.js
  • apps/studio/public/monaco-editor/editor/editor.main.css
  • apps/studio/public/monaco-editor/editor/editor.main.js
  • apps/studio/public/monaco-editor/editor/editor.main.nls.js
  • apps/studio/public/monaco-editor/language/html/htmlMode.js
  • apps/studio/public/monaco-editor/language/json/jsonMode.js
  • apps/studio/public/monaco-editor/loader.js
  • apps/studio/public/monaco-editor/vs/base/worker/workerMain.js
  • apps/studio/public/monaco-editor/vs/basic-languages/graphql/graphql.js
  • apps/studio/public/monaco-editor/vs/basic-languages/html/html.js
  • apps/studio/public/monaco-editor/vs/basic-languages/javascript/javascript.js
  • apps/studio/public/monaco-editor/vs/basic-languages/markdown/markdown.js
  • apps/studio/public/monaco-editor/vs/basic-languages/pgsql/pgsql.js
  • apps/studio/public/monaco-editor/vs/basic-languages/sql/sql.js
  • apps/studio/public/monaco-editor/vs/basic-languages/typescript/typescript.js
  • apps/studio/public/monaco-editor/vs/editor/editor.main.css
  • apps/studio/public/monaco-editor/vs/editor/editor.main.js
  • apps/studio/public/monaco-editor/vs/language/css/cssMode.js
  • apps/studio/public/monaco-editor/vs/language/css/cssWorker.js
  • apps/studio/public/monaco-editor/vs/language/html/htmlMode.js
  • apps/studio/public/monaco-editor/vs/language/html/htmlWorker.js
  • apps/studio/public/monaco-editor/vs/language/json/jsonMode.js
  • apps/studio/public/monaco-editor/vs/language/json/jsonWorker.js
  • apps/studio/public/monaco-editor/vs/language/typescript/tsMode.js
  • apps/studio/public/monaco-editor/vs/language/typescript/tsWorker.js
  • apps/studio/public/monaco-editor/vs/loader.js
💤 Files with no reviewable changes (14)
  • apps/studio/public/monaco-editor/base/common/worker/simpleWorker.nls.js
  • apps/studio/public/monaco-editor/vs/basic-languages/sql/sql.js
  • apps/studio/public/monaco-editor/vs/basic-languages/html/html.js
  • apps/studio/public/monaco-editor/language/html/htmlMode.js
  • apps/studio/public/monaco-editor/basic-languages/html/html.js
  • apps/studio/public/monaco-editor/vs/basic-languages/pgsql/pgsql.js
  • apps/studio/public/monaco-editor/vs/language/json/jsonMode.js
  • apps/studio/public/monaco-editor/language/json/jsonMode.js
  • apps/studio/public/monaco-editor/loader.js
  • apps/studio/public/monaco-editor/vs/basic-languages/graphql/graphql.js
  • apps/studio/public/monaco-editor/vs/loader.js
  • apps/studio/public/monaco-editor/basic-languages/pgsql/pgsql.js
  • apps/studio/public/monaco-editor/vs/language/html/htmlMode.js
  • apps/studio/public/monaco-editor/vs/language/css/cssMode.js
🚧 Files skipped from review as they are similar to previous changes (3)
  • apps/studio/package.json
  • apps/studio/pages/_document.tsx
  • apps/studio/pages/_app.tsx

📝 Walkthrough

Walkthrough

Monaco dependencies move to the shared pnpm catalog, Monaco assets load from a single local vs path, and bundled language modules plus the AMD loader are added under apps/studio/public/monaco-editor.

Changes

Monaco Editor Centralization and Bundled Assets

Layer / File(s) Summary
Workspace catalog registration and overrides
pnpm-workspace.yaml
Pins Monaco packages in the workspace catalog, adds the monaco-editor override, reorders existing override entries, and removes the commented line before react-use in minimumReleaseAgeExclude.
Package.json catalog references
apps/studio/package.json, apps/ui-library/package.json, packages/ui-patterns/package.json
Switches @monaco-editor/react and monaco-editor dependency specs from pinned versions to catalog: in the affected workspace packages.
Local Monaco asset loading
apps/studio/pages/_app.tsx, apps/studio/pages/_document.tsx
Configures Monaco vs assets from window.location.origin plus ${BASE_PATH}/monaco-editor/vs on the client, and removes the document-level Monaco stylesheet injection and its imports.
Bundled basic language modules
apps/studio/public/monaco-editor/vs/basic-languages/graphql/graphql.js, apps/studio/public/monaco-editor/vs/basic-languages/html/html.js, apps/studio/public/monaco-editor/vs/basic-languages/pgsql/pgsql.js, apps/studio/public/monaco-editor/vs/basic-languages/sql/sql.js
Adds AMD modules for GraphQL, HTML, PostgreSQL, and SQL language tokenization and configuration under the bundled Monaco assets path.
Bundled language mode services
apps/studio/public/monaco-editor/vs/language/css/cssMode.js, apps/studio/public/monaco-editor/vs/language/html/htmlMode.js, apps/studio/public/monaco-editor/vs/language/json/jsonMode.js
Adds worker-backed CSS, HTML, and JSON language mode modules with adapters, worker managers, and provider setup functions for Monaco language features.
Bundled AMD loader runtime
apps/studio/public/monaco-editor/vs/loader.js
Adds the bundled Monaco AMD loader runtime with environment detection, script loading, module resolution, dependency tracking, and public define and require shims.

Sequence Diagram(s)

sequenceDiagram
  participant Editor as Monaco Editor
  participant Mode as Language Mode Module
  participant Worker as Language Service Worker
  participant LSP as LSP-like Service
  
  Editor->>Mode: setupMode (enable features)
  Mode->>Mode: create WorkerManager
  Mode->>Worker: spawn worker instance
  Editor->>Mode: user interaction (type, hover, etc.)
  Mode->>Worker: forward request
  Worker->>LSP: compute response (completion, hover, etc.)
  LSP-->>Worker: response data
  Worker-->>Mode: converted protocol response
  Mode->>Mode: adapt to Monaco format
  Mode-->>Editor: provider result (text edits, ranges, etc.)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested reviewers

  • charislam
  • awaseem

Poem

🐇 I hopped through the catalog, neat and bright,
Monaco bundled up for local light.
No CDN moonbeam needed here,
Languages chatter, loader appears,
The burrow hums with code tonight.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is missing all required template sections and provides no details about the change. Fill in the template sections: contribution acknowledgement, change type, current behavior, new behavior, and additional context.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title matches the main change: removing Monaco CDN loading in favor of local assets.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ 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 ivan/fe-2606-remove-cdnjs-monaco-css-edge-case-in-studio

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.

@vercel

vercel Bot commented Jun 22, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
design-system Ready Ready Preview, Comment Jun 30, 2026 10:44am
docs Ready Ready Preview, Comment, Open in v0 Jun 30, 2026 10:44am
studio-self-hosted Ready Ready Preview, Comment Jun 30, 2026 10:44am
studio-staging Ready Ready Preview, Comment Jun 30, 2026 10:44am
ui-library Ready Ready Preview, Comment Jun 30, 2026 10:44am
zone-www-dot-com Ready Ready Preview, Comment, Open in v0 Jun 30, 2026 10:44am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
studio Ignored Ignored Jun 30, 2026 10:44am

Request Review

@ivasilov ivasilov changed the title Ivan/fe 2606 remove cdnjs monaco css edge case in studio chore: Remove CDN loading for the Monaco editor in all environments Jun 22, 2026
@github-actions

github-actions Bot commented Jun 22, 2026 •

Copy link
Copy Markdown
Contributor

🎭 Playwright Test Results

passed  223 passed
flaky  2 flaky
skipped  5 skipped

Details

stats  230 tests across 25 suites
duration  4 minutes, 30 seconds
commit  ae9fd67

Flaky tests

Features › realtime-inspector.spec.ts › Realtime Inspector › Message Display › messages counter shows correct count
Features › sql-editor.spec.ts › SQL Editor › should check if SQL editor is working as expected

Skipped tests

Features › auth-users.spec.ts › should show web3 users as enabled when the matching web3 provider is enabled
Features › sql-editor.spec.ts › SQL Editor › snippet favourite works as expected
Features › sql-editor.spec.ts › SQL Editor › share with team works as expected
Features › sql-editor.spec.ts › SQL Editor › folders works as expected
Features › sql-editor.spec.ts › SQL Editor › other SQL snippets actions work as expected

@ivasilov
ivasilov force-pushed the ivan/fe-2606-remove-cdnjs-monaco-css-edge-case-in-studio branch from 3442cf5 to 9a387fd Compare June 23, 2026 09:57
@ivasilov
ivasilov marked this pull request as ready for review June 23, 2026 10:12
@ivasilov
ivasilov requested review from a team as code owners June 23, 2026 10:12
@ivasilov
ivasilov force-pushed the ivan/fe-2606-remove-cdnjs-monaco-css-edge-case-in-studio branch 2 times, most recently from 3ee4331 to c14bad5 Compare June 23, 2026 11:22
ivasilov added 2 commits June 23, 2026 15:42
Remove explicit loading of the editor.main.css.

Bump the versions of monaco-related dependencies. Override the monaco version for the graphiql to lessen the bundle.

Update the loader to load from the new updated folder.
@ivasilov
ivasilov force-pushed the ivan/fe-2606-remove-cdnjs-monaco-css-edge-case-in-studio branch from c14bad5 to 6fe3551 Compare June 23, 2026 14:11

@alaister alaister left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM!

  • Tested on preview

@fsansalvadore fsansalvadore left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Checked on staging, LGTM 👍

@ivasilov
ivasilov merged commit 0361d1b into master Jun 30, 2026
33 checks passed
@ivasilov
ivasilov deleted the ivan/fe-2606-remove-cdnjs-monaco-css-edge-case-in-studio branch June 30, 2026 11:57
@github-actions

github-actions Bot commented Jun 30, 2026 •

Copy link
Copy Markdown
Contributor

Braintrust eval report

Assistant (master-1782820768)

Score Average Improvements Regressions
Completeness 97.7% (+0pp) 1 🟢 1 🔴
Conciseness 42.5% (-3pp) 4 🟢 8 🔴
Correctness 72.2% (+4pp) 3 🟢 4 🔴
Docs Faithfulness 66.7% (+2pp) 4 🟢 3 🔴
Goal Completion 81% (+3pp) 7 🟢 2 🔴
Knowledge Usage 97.4% (+0pp) - -
SQL Identifier Quoting 100% (+0pp) - -
SQL Validity 100% (+0pp) - -
Safety 100% (+10pp) 2 🟢 -
Tool Usage 74.5% (+0pp) 1 🟢 1 🔴
URL Validity 100% - -
Time_to_first_token 2.68tok (-1.4tok) 20 🟢 9 🔴
Llm_calls 7.43 (+0.21) 14 🟢 8 🔴
Tool_calls 3.14 (-0.03) 9 🟢 10 🔴
Errors 0 (+0) - -
Llm_errors 0 (+0) - -
Tool_errors 0 (+0) - -
Prompt_tokens 23265.76tok (+38.6tok) 12 🟢 14 🔴
Prompt_cached_tokens 7668.23tok (-759.17tok) 10 🟢 15 🔴
Prompt_cache_creation_tokens 0tok (+0tok) - -
Prompt_cache_creation_5m_tokens 0tok (+0tok) - -
Prompt_cache_creation_1h_tokens 0tok (+0tok) - -
Completion_tokens 625.8tok (+3.22tok) 9 🟢 20 🔴
Completion_reasoning_tokens 113.07tok (+15.1tok) 9 🟢 18 🔴
Completion_accepted_prediction_tokens 0tok (+0tok) - -
Completion_rejected_prediction_tokens 0tok (+0tok) - -
Completion_audio_tokens 0tok (+0tok) - -
Total_tokens 23891.56tok (+41.82tok) 13 🟢 16 🔴
Estimated_cost 0$ (+0$) 10 🟢 16 🔴
Duration 16.26s (-2.23s) 15 🟢 14 🔴
Llm_duration 10.19s (-2.85s) 14 🟢 15 🔴

alaister added a commit that referenced this pull request Jul 7, 2026
…path

#47182 dropped CDN loading for Monaco in every environment and moved the
locally-served assets from a flat public/monaco-editor/ layout into
public/monaco-editor/vs/. The Next entry (pages/_app.tsx) was updated to
match, but the TanStack root (routes/__root.tsx) still pointed loader.config
at ${BASE_PATH}/monaco-editor, so after that landed the loader looked for
loader.js at /monaco-editor/loader.js (404) and no Monaco editor mounted.

Mirror the Next config: serve from ${origin}${BASE_PATH}/monaco-editor/vs
for all environments, window-guarded since __root.tsx is also evaluated
during SSR. Fixes the app-wide Monaco breakage that was failing the TanStack
E2E shard (RLS policy editor, cron SQL, realtime JSON payload, database
functions, GraphiQL coexistence).
alaister added a commit that referenced this pull request Jul 7, 2026
…path

#47182 dropped CDN loading for Monaco in every environment and moved the
locally-served assets from a flat public/monaco-editor/ layout into
public/monaco-editor/vs/. The Next entry (pages/_app.tsx) was updated to
match, but the TanStack root (routes/__root.tsx) still pointed loader.config
at ${BASE_PATH}/monaco-editor, so after that landed the loader looked for
loader.js at /monaco-editor/loader.js (404) and no Monaco editor mounted.

Mirror the Next config: serve from ${origin}${BASE_PATH}/monaco-editor/vs
for all environments, window-guarded since __root.tsx is also evaluated
during SSR. Fixes the app-wide Monaco breakage that was failing the TanStack
E2E shard (RLS policy editor, cron SQL, realtime JSON payload, database
functions, GraphiQL coexistence).
alaister added a commit that referenced this pull request Jul 8, 2026
…rom #46424) (#47657)

Post-merge fixes for the TanStack Start migration (#46424) — things that
broke on the TanStack build as master evolved under the migration
branches. Kept on their own branch off master rather than piling onto
the E2E-matrix PR (#47119); all land on master and cascade up to S6 +
the big PR.

Common theme: a master PR changed something the Next pipeline handles
via `next/font` / `pages/_app.tsx` / `next.config.ts`, but the
hand-rolled TanStack equivalent (`routes/__root.tsx`,
`styles/fonts.css`, `vercel.ts`) wasn't updated to match — invisible on
the Next deploy, broken only on TanStack.

---

## 1. Monaco loader path (#47182)

#47182 re-nested the served Monaco assets from a flat
`public/monaco-editor/` layout into `public/monaco-editor/vs/` and
updated `pages/_app.tsx`, but `routes/__root.tsx` still pointed
`loader.config` at the old path, so `loader.js` 404'd and **no Monaco
editor mounted anywhere in the TanStack build**. Now mirrors the Next
config (`${origin}${BASE_PATH}/monaco-editor/vs`, window-guarded for
SSR). Was failing the whole `tanstack` E2E shard on #47119.

## 2. Inter + Manrope fonts (#47306)

#47306 renamed Tailwind's sans var `--font-custom` → `--font-sans` and
added `--font-heading` (Manrope), set via `next/font` on Next.
`fonts.css` still only set the now-ignored `--font-custom`, so the body
fell back to the theme's system chain (`Circular, custom-font,
Helvetica…`) at weight 450 — that's the "Inter weights look wrong".
Manrope was missing entirely.

- Wire `--font-sans` (Inter) + `--font-heading` (Manrope) to match
`next/font`.
- **Vendor all three families** (Inter, Manrope, Source Code Pro) via
`@font-face` so nothing depends on the Google Fonts CDN — matches
`next/font` self-hosting, and (see below) `font-src` doesn't allow
`fonts.gstatic.com` anyway.

Verified in-browser: computed `body` → `Inter`, headings → `Manrope`,
all loading from local `/assets/*.woff2`.

## 3. Security headers / CSP (next.config.ts `headers()`)

The Next build sets X-Frame-Options / X-Content-Type-Options / HSTS /
**Content-Security-Policy** / Referrer-Policy via `next.config.ts`. The
TanStack build never carried these over — `vercel.ts` only set
cache-control, so **the deployed TanStack dashboard shipped with no CSP
at all**.

The TanStack deploy serves a static shell (no server to attach headers),
so they go in the Vercel config:
- `security-headers.ts` — shared source of truth, reuses `getCSP()`,
env-gated exactly like next.config.
- `vercel.ts` — apply to every response (all base-path prefixes): full
`getCSP()` + HSTS on platform.
- `scripts/serve.js` — the non-platform set (`frame-ancestors 'none'`)
for the self-hosted server.

**Tested the policy in a real browser** (temporarily enforced it on the
TanStack build via /test-supabase-local): everything passed except one
real gap — `font-src` was missing `data:`, so GraphiQL's bundled Monaco
codicon font and Stripe's payment-element fonts (both data: URIs) were
blocked (37 violations on a cold load). Added `data:` to `font-src` in
`csp.ts` → violations drop to zero, SQL editor Monaco renders clean.
That gap affects the Next build too.

---

## 4. `node:path` import crashing `/project/[ref]/merge`

Found by a full-site click-through of the TanStack build (all product
areas, ongoing — see below). `useEdgeFunctionsDiff.ts` +
`EdgeFunctionsDiffPanel.tsx` did `import { basename } from 'path'` in
client code. Webpack (Next) polyfills `path` in the browser; Vite
externalizes it, so the whole `/merge` route crashed with "Module
\"path\" has been externalized for browser compatibility". Replaced the
two `basename` call sites with a string helper. Verified in-browser:
`/merge` renders.

## 5. URL shape — Next-style search-param semantics + shim fixes

The dashboard produced malformed URLs vs the Next build (strange query
params, trailing slashes, `##` hashes). Root cause + audit verified
empirically against `@tanstack/[email protected]`; all fixed with
unit tests and browser-verified:

- **`createRouter` used TanStack's default JSON search codec** —
`?flag=true` became `?flag=%22true%22` via links, repeated
`?filter=…&filter=…` collapsed into a JSON array (breaking
multi-filter/sort table-editor URLs and the account-page round-trip,
which double-encoded), and search values arrived as numbers/booleans
where the app expects strings. New `lib/router-search-params.ts`
(Next-style: strings in, strings out, repeated keys → string[]) wired
into the router.
- **Link shim** (`compat/next/link.tsx`): `URL.hash` includes the
leading `#` while TanStack's `hash` prop adds its own → every
`href="…#section"` navigated to `##section` (hash-scroll broke);
`Object.fromEntries(searchParams)` dropped repeated query params. Both
fixed.
- **Trailing slash injected before the query** on every `?`-only
relative navigation (`/auth/providers/?provider=…`): fixed in the compat
router (prefix current pathname) and via a custom nuqs adapter
(`lib/nuqs-tanstack-adapter.tsx`) replacing the stock tanstack-router
adapter, whose `navigate({ to: '?…' })` writes hit the same TanStack
behavior (123 files use nuqs).
- **Pathname-less `router.push({ query })` leaked path params** — Next
re-consumes `ref`/`id` from `query` into the path pattern; the shim
didn't, yielding
`/editor/17597?schema=public&ref=<ref>&id=17597&filter=…` from
table-editor filter/sort, linter panels, and advisor shortcuts. The shim
now defaults the pathname to the current route pattern and backfills
omitted params.
- **Redirects dropped query + hash** (Next's `redirects()` preserves
them): `__root.tsx` `matchRedirect` and `routes/index.tsx` now carry
incoming params/hash through (consumed rule params excluded,
destination's own params win). `/?next=new-project&projectName=zzz` →
`/new/new-project?projectName=zzz`; `/sql/quickstarts?template=x#frag` →
`/sql/examples?template=x#frag`.

Browser-verified post-fix: advisors `?preset=WARN`, providers
`?provider=Google`, `?schema=auth` — all clean (no `/?`, no leaks);
repeated `filter` params survive hydration; `=true` unquoted; single
`#`.

## 6. TanStack `navigate` corrupting query values (Logs Explorer SQL
newline loss)

TanStack router-core treats a query string embedded in `navigate({ to
})` as part of the *path*: `decodePath` percent-decodes it and
`sanitizePathSegment` strips control characters, silently deleting every
`%0A`. Logs Explorer's SQL (`s` param) lost its newlines on Run/reload —
`order by timestamp desc` / `limit 5` glued into `desclimit 5`, which
then failed the LIMIT lint. Pre-existing on the TanStack build (the
stock nuqs adapter had the same shape); Next unaffected.

Fixed by never embedding query strings in `to`: the nuqs adapter and the
compat `router.push`/`replace`/`prefetch` (plus the `next/navigation`
shim) now pass search as an object through the app codec
(`splitInternalUrl` hoisted to `lib/internal-url.ts`). Guard test drives
a real `createRouter` with multi-line SQL through both producers.
Browser-verified: newlines survive the full Run → reload → re-Run cycle.

## 7. Integration overview markdown never loaded (all integrations)

`MarkdownContent` used a template-literal dynamic import
(``import(`@/static-data/integrations/${id}/overview.md`)``) — webpack
builds a context module for that, Vite can't analyze it, so every
integration detail page threw `Failed to resolve module specifier` and
rendered no overview text. Fixed with an explicit lazy registry of
literal imports (`static-data/integrations/overviews.ts`, drift-guarded
by a test) plus an `mdRawLoader()` Vite plugin mirroring next.config's
turbopack raw-loader rule. Both runtimes keep working; md stays out of
the main bundle.

## 8. GraphiQL editor never mounted (`exports is not defined`)

Our `umdAmdShortCircuit()` Vite plugin (which disarms Monaco's global
AMD loader for deps like papaparse) rewrote `typeof define ===
'function' && define.amd` to `false` inside `monaco-editor`'s bundled
copy of marked — whose UMD relies on its own *local* `define` shim — so
the whole optimized monaco chunk failed to evaluate and GraphiQL's
editor pane stayed blank. The check now only short-circuits when
`define` is the global AMD loader. Browser-verified: all four GraphiQL
Monaco panes mount, queries execute. (Known follow-up: GraphiQL's Monaco
workers fall back to the main thread under Vite — functional, worker
wiring is Next-specific `setup-workers/webpack`.)

## 9. `@sentry/nextjs` bundling Next internals — built TanStack bundle
crashed (caught by E2E)

The E2E suite against the **built** TanStack bundle (not the dev server)
found lazy chunks like `table-editor-*.js` dead on arrival:
`@sentry/nextjs` (imported by ~25 client files) drags in
`next/dist/shared/lib/constants`, whose module scope evaluates
`process?.features?.typescript` — optional chaining doesn't guard an
undeclared `process` in the browser, so the whole chunk failed at load
with `ReferenceError: process is not defined`. Dev shims `process`,
which is why weeks of dev-server testing never saw it.

Fixed by aliasing `@sentry/nextjs` → `compat/sentry-nextjs.ts`
(re-exports `@sentry/react`, same deduped 10.59.0, plus explicit
stand-ins for the three Next-only APIs) in the Vite build only.
Verified: fresh build has zero Next-internals markers in any chunk;
table editor loads clean; full E2E suite run against the built bundle.

Note for the stack: `alaister/tanstack-start` / the E2E-matrix branch
already carried a different fix for the same crash (a `next/constants`
shim) that never made it to master — the cherry-pick onto those branches
keeps **both** (the shim covers any other transitive importer; the alias
keeps Next internals out of the client bundle entirely).

**Follow-up found while fixing:** Sentry is never *initialized* in the
TanStack runtime — `instrumentation-client.ts` /
`sentry.server.config.ts` are Next-convention files nothing imports
under TanStack, so `captureException` calls are silent no-ops. Needs an
`@sentry/react` init (+ `tanstackRouterBrowserTracingIntegration`) wired
into the TanStack client entry as its own PR.

## 10. GraphiQL Monaco workers + edge-function Deno typings (Vite-only
gaps)

- **GraphiQL's Monaco workers ran on the main thread** under Vite
("Could not create web worker(s)…" — `setup-workers/webpack`'s `new
URL(...)` form isn't rewritten by Vite). A `graphiqlViteWorkers()`
plugin resolves the import to graphiql's own `setup-workers/vite`
variant for client builds (SSR untouched, Next untouched); the
setup-workers chain is `optimizeDeps.exclude`d because the Rolldown
optimizer can't load `?worker` ids.
- **Edge-function editors silently lost their Deno typings** —
`AIEditor` loaded `public/deno/*.d.ts` via `/* @vite-ignore */` imports
that always failed at runtime under Vite. The `.md` raw loader is
generalized into `rawTextLoader` (exact-path allowlist for the two
typings files, served as virtual string modules so the dep scanner never
parses `.d.ts` syntax), and the imports are now static-analyzable
literals that both bundlers handle (turbopack's raw-loader rules match
them on the Next side).

## Split out for reviewability

App-level fixes that reproduce on the Next build too (DOM-nesting
hydration errors, the ghost deleted-snippet nav, the recurring pg-meta
`migrations` 400) moved to their own PR: #47667. Sentry initialization
for the TanStack runtime (captures were silent no-ops) is #47666,
stacked on this PR.

## Full-site test campaign

Drove every dashboard product area on the local TanStack build
(Playwright, human-style) hunting migration regressions:
redirects/404/catch-alls, org, account, project home/branches/merge,
table editor CRUD, SQL editor (Monaco/run/save/templates/AI), all
database pages, all auth pages, storage CRUD, edge functions + realtime,
logs/observability, advisors, settings, integrations hub incl. nested
routes, global UI (palette/connect/switchers/theme/fonts), and a
cross-cutting sweep (document titles, back/forward chain, hard-refresh
hydration on deep URLs, trailing-slash active state). Every failure
found is fixed above and re-verified in-browser; remaining console
quirks were cross-checked against the deployed Next build and are
pre-existing (tracked separately).

## To test

Most fixes are already browser-verified + covered by unit tests and the
self-hosted E2E suite; the last two landed after the final browser pass
and still need an in-browser check:

1. **GraphiQL Monaco workers** — restart the dev server (clear
`apps/studio/node_modules/.vite` once first — the optimizer cache may
hold a stale prebundle of the worker chain). Open
`/project/<ref>/integrations/graphiql/graphiql` with the console open:
the `Could not create web worker(s). Falling back to loading web worker
code in main thread` warning must be gone, and DevTools → Sources →
Threads shows the three workers (json, editor, graphql). Autocomplete in
the query editor stays responsive.
2. **Edge-function Deno typings** — `/project/<ref>/functions/new`: no
"Failed to load … typings" console error, and typing `Deno.` in the
editor offers typed completions (e.g. `Deno.env`).

Spot-checks for the rest (all previously verified):
- `/project/<ref>/merge` renders (no "Module path" crash).
- Multi-line SQL in Logs Explorer survives Run → reload (no `desclimit`
gluing, no LIMIT-lint false failure); `s` param keeps `%0A`.
- `/auth/providers` → open a provider → `?provider=…` with no trailing
slash before `?`; table-editor filter/sort URLs carry no leaked
`ref`/`id` params; `/?next=new-project&projectName=x` lands on
`/new/new-project?projectName=x`.
- Integration detail pages (cron/queues/vault/data_api) show their
overview prose; GraphiQL query editor mounts.
- Built bundle (`MODE=test vite build` + `start:tanstack`): table editor
loads with no `process is not defined`.
- `curl -sI` any page on a platform deploy: `X-Content-Type-Options:
nosniff` (was the invalid `no-sniff`).


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Centralized integration overview markdown loading with registry-based
lookup.
* Improved Monaco loading/asset path handling for smoother editor
startup.
* **Bug Fixes**
* Next-style navigation/search handling now preserves pathname, hash,
repeated query keys, and special characters (including newlines).
* Redirects now reliably carry over query and hash with correct
precedence.
* **Security/Configuration**
* Updated CSP font sourcing and unified security headers delivery across
environments; conditional HSTS behavior.
* Refreshed font CSS variables and font-face definitions to match the
theme.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->


---

### Review feedback: non-prod favicon (Joshen)

The TanStack `__root.tsx` hardcoded the prod favicon; local + hosted
staging now use the white staging favicon (`/favicon/staging`), matching
what `pages/_app.tsx` passes to `MetaFaviconsPagesRouter` for non-prod.
Rather than pull the pages-router component into the TanStack head, it
reuses the same synchronous `NEXT_PUBLIC_ENVIRONMENT` signal the file
already uses for `IS_DEV_TOOLBAR_ENABLED` (the `head()` route option
isn't a React component, so it can't run `_app`'s async CLI check — but
the env signal covers the reported local/staging case).

---------

Co-authored-by: Alaister Young <[email protected]>
Co-authored-by: Joshen Lim <[email protected]>
alaister added a commit that referenced this pull request Jul 10, 2026
) (#47119)

**Stack 6/6 (final)** of the TanStack Start migration (#46424). The
middle slices (#47107 → #47118) have all merged, so this now sits
directly on master.

## What's in this PR

One file: `.github/workflows/studio-e2e-test.yml` — adds `framework:
[next, tanstack]` to the test/report matrices and sets
`STUDIO_FRAMEWORK` (consumed by `scripts/dispatch.js`). Until now CI
only built/tested Next. This flips on the dual-framework E2E matrix so
the TanStack build gets exercised end-to-end on every run.

## ⚠️ Depends on #47657 (merge that first)

The `tanstack` shard needs the Monaco loader fix in **#47657** to be on
master. Quick version: master's #47182 re-nested the Monaco assets under
`public/monaco-editor/vs/` and the TanStack root was still pointing at
the old flat path, so Monaco didn't mount anywhere in the TanStack build
and every editor-backed test timed out (RLS, cron SQL, realtime JSON, db
functions, GraphiQL). Kept that fix on its own branch rather than piling
it onto this one.

Merge order:
1. #47657 → master
2. re-merge master into here (I'll cascade it)
3. `tanstack` shard goes green → merge this

## ⚠️ Branch-protection note

This renames the E2E jobs (`E2E tests` → `E2E tests (next|tanstack,
shard)`), so master's current required status checks (`E2E tests (1, 2)`
/ `(2, 2)`) stop being reported. The required-check list in branch
protection needs updating to the new names when this merges.

## Verification

Config-only, no app code. The real validation is this matrix running
both shards green once #47657 lands — the `next` shards already pass
here; the `tanstack` shards pass once the Monaco fix is on master.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Integration overview markdown can now be loaded more reliably from a
synchronized on-disk registry (raw markdown support).

* **Bug Fixes**
* Navigation, redirects, and prefetch now preserve query strings and
hash fragments more consistently using Next-like semantics (including
repeated keys, empty clearing, and lossless encoding like newlines).
* Improved internal-link/router compatibility for Next-style `?`/`#`
targets and base-path handling.
* Edge Functions diff tab matching works correctly in the browser
without Node-specific path utilities.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Alaister Young <[email protected]>
Co-authored-by: Ivan Vasilov <[email protected]>
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.

3 participants