Skip to content

[internal] Upgrade to core-js v3 - #418

Merged
atomiks merged 1 commit into
mui:masterfrom
atomiks:chore/corejs
May 28, 2024
Merged

atomiks merged 1 commit into
mui:masterfrom
atomiks:chore/corejs

Conversation

@atomiks

@atomiks atomiks commented May 27, 2024

Copy link
Copy Markdown
Contributor

core-js 2 has been deprecated for a while and has started to cause bugs with new Promise APIs in the docs.

@atomiks atomiks added the core label May 27, 2024
@mui-bot

mui-bot commented May 27, 2024

Copy link
Copy Markdown

@atomiks
atomiks merged commit f092e7f into mui:master May 28, 2024
@oliviertassinari oliviertassinari added internal Behind-the-scenes enhancement. Formerly called “core”. and removed core labels Aug 2, 2025
@oliviertassinari oliviertassinari changed the title [core] Upgrade to core-js v3 [internal] Upgrade to core-js v3 Feb 6, 2026
michaldudak added a commit to michaldudak/base-ui that referenced this pull request Jun 10, 2026
Extract the nonce + isHydrating + <script> element into a shared
PrehydrationScript component, removing the duplicated logic from TabsIndicator
and SliderThumb. Callers gate it structurally (renderBeforeHydration, plus
inset/last for the slider); the component only owns the hydration mechanics.
The script string is still imported per-component through the #prehydration/*
subpath import (stubbed in client bundles).

The component keeps rendering the <script> element with empty content on the
client during the hydration pass, rather than returning null: the server emits
the element, so dropping it on the client triggers a recoverable hydration
error (React mui#418, verified in a production build). suppressHydrationWarning
bridges the content difference and the element unmounts once isHydrating flips
to false. Only the script body is excluded from client bundles, not the
component.

Co-Authored-By: Claude Fable 5 <[email protected]>
@atomiks
atomiks deleted the chore/corejs branch August 11, 2026 03:01
arindampradhan added a commit to noevaresearch/base-ui that referenced this pull request Sep 10, 2026
…te — the inline-script emitter that positions server-rendered content ahead of hydration (PrehydrationScript.tsx:32-49, consumed by Tabs.Indicator at TabsIndicator.tsx:170 and Slider.Thumb at SliderThumb.tsx:469): use_is_hydrating.rs ports packages/react/src/utils/useIsHydrating.ts (the useSyncExternalStore no-subscribe hook whose getServerSnapshot=true/getSnapshot=false pair yields exactly one true pass during server render + hydration and false for fresh client mounts, useIsHydrating.ts:4-14) as a module-level ArcRwSignal<bool> global the future SSR/hydration runtime drives through set_is_hydrating — the runtime seam standing in for React resolving the snapshot pair, default false (the fresh-client-mount world the crate runs in), the flip a real signal write so reactive consumers re-run (upstream's forced post-hydration re-render that unmounts the element, PrehydrationScript.tsx:20-21); prehydration_script.rs ports the component: useCSPContext for the nonce (:34) riding the lazy-attribute convention (the composite_view roving-tabIndex precedent — the memo re-read at attribute-read time, None yields no attribute), the hydration gate returning None (the :37-39 null branch), and the script-element description (tag 'script', the body as the new RenderElementProps::inner_html member — the dangerouslySetInnerHTML analog at :45) built directly rather than through useRenderElement because upstream returns a bare <script>, not a merge call site; RenderElementProps gains inner_html (merge_into folds it as a plain prop key — later bag wins only when carried, per mergeProps' for-in-over-own-keys — is_empty counts it, create_element applies it via set_inner_html) with a host merge test; N/A adaptations documented in the module docs: the #prehydration/* browser-condition stub (packages/react/package.json:112-118, prehydrationScript.stub.ts:6 — no JS bundler; the body is inert data until a script element carrying it connects, and a plain client mount emits nothing because the flag defaults false), suppressHydrationWarning (no reconciler comparing content), the React mui#418 client-bundle constraint (the gate itself expresses the hydration-tree-matches-server rule), and 'use client'; the ArcRwSignal backing is deliberate and documented — a plain RwSignal lazily created inside a test/app owner registers its wasm ArenaItem storage with that owner and is disposed with it, panicking every later reader (observed as a wasm-only latent failure this iteration — the host's Arc storage has no owner-registered arena item, so only the browser suite caught it; ArcRwSignal is pure Arc/RwLock state with no owner registration, the app-long-lived contract); the unit has no upstream tests (implementation.md untested-source item 5), so 6 host tests pin the written mechanics (the flag default, the runtime pass flip, the read-only tracked surface, the gate short-circuit, the description shape, the nonce lazy-attribute flow incl. the provider case) and 6 wasm tests pin the browser behavior (materialized <script> carrying the body, the provider nonce attribute, the end-to-end feature — the detached element has not executed until it connects and the browser runs the body on insertion exactly as server HTML parses, and the gate/unmount matrix); 260 host + 352 wasm crate-wide, wasm suite run in-browser (Chrome 152 + chromedriver 152.0.7977.82 re-fetched per the .cargo/config.toml recipe — the prior session's driver copy lost its execute bit)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal Behind-the-scenes enhancement. Formerly called “core”.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants