Repository navigation
Description
Severity: HIGH, regression since 0.10.0a1 (present on 0.10.0a2; absent on 0.9.12 with the same reflex-enterprise 0.9.7a4 wheel). Independently confirmed. Release blocker for 0.10.0. Enterprise-side mitigation tracked in reflex-dev/reflex-enterprise#260.
What happens
In reflex run --env prod, on a prerendered (static) route, an rxe.ag_grid(column_defs=GridState.cols, row_data=GridState.rows) whose column_defs come from a State var renders an empty box (0 header cells, 0 body cells) on full page load and on reload, while a grid with literal column_defs on the same page renders normally. Nothing is logged. Same for @rx.memo grids, rx.ComponentState grids, the enterprise demo's /master-detail page, and Var-valued detail_cell_renderer_params (the detail grid has no columns after expanding a row). Dev mode, dynamic routes (/item/[pid]) and client-side navigation are fine; the grid recovers after any event on its own substate.
Why
The compiled root.jsx is identical on 0.9.12, a1 and a2: window.__reflex is assigned in a ReflexProviders useEffect (reflex_base/compiler/templates.py ~L214), i.e. after the prerendered page's first render. Enterprise's formatColumnDefs returns [] while typeof __reflex === 'undefined'. On 0.9.12 the first boot delta carried every substate, so every state consumer re-rendered once after hydration and picked __reflex up. Since #7064 the single hydrate_and_load delta carries only the changed substates (reflex/state.py hydrate_and_load → _diff_against_initial_state, which drops untouched substates), so a consumer of an unchanged substate renders once with __reflex undefined and stays that way. A core-only probe (an rx.Component rendering typeof window.__reflex next to a consumer of an untouched substate) shows NO_REFLEX on a1/a2 prod and HAS_REFLEX on 0.9.12 prod and a2 dev; a probe with only literal props stays NO_REFLEX on every version, so rendering before __reflex exists is old behaviour that 0.9.12 merely hid for state consumers.
Timeline (a2, enterprise, full load): 206 ms probe renders NO_REFLEX → 241 ms window.__reflex assigned → 329 ms delta with the root state only; grid stays empty. 0.9.12: 240 ms __reflex assigned → 342 ms delta with all substates → 343 ms probe re-renders → 375 ms grid shows its headers.
Blast radius
Enterprise AG Grid Var-valued column_defs / detail_cell_renderer_params; any user code reading window.__reflex at render time on a prerendered prod page. Not affected: dynamic components (@rx.var -> rx.Component, evaluated in a useEffect), lambda cell renderers (read __reflex at cell-render time). No other render-time readers in the published reflex / reflex-base / reflex-components-* wheels (dynamic.py, evalReactComponent) or in the enterprise wheel outside aggrid.py / vars.py. REFLEX_FRONTEND_LAZY_BUNDLED_LIBRARIES=true renders every grid but a lambda cell_renderer returning rx.badge then crashes with React #130.
Suggested fix
In reflex: make window.__reflex available before the first render in the default path, the way the lazy-libraries path already does at module scope guarded by typeof window (templates.py ~L226-231). This also fixes the older literal-props case. Do not re-send every substate at boot (gives up #7064's gain and only hides the ordering). Separately, reflex-enterprise can drop the typeof __reflex guard in formatColumnDefs (aggrid.py ~L2286-2290) so already-shipped wheels stop depending on boot order (reflex-dev/reflex-enterprise#260).
Repro and evidence
- Minimal app + Playwright driver, matrix over 0.9.12 / a1 / a2 prod and a2 dev, boot websocket frames with the
window.__reflexsetter trapped: ent_grid/verification/NOTES.md,out/SUMMARY.md,out/entv_a2_prod/s2_reload.jpg,out/corev_*_prod/c1_full_load.json. - Explorer write-up and the
aggrid_min/core_rerenderrepro apps: ent_grid/NOTES.md §1a. - Finding N-025 in FINDINGS.md.
Activity
linear-code commentedon Oct 7, 2026
ENG-13136
Expose window.__reflex before the first render
masenf commentedon Oct 7, 2026
Resolution update: the core-side fix (#7492, exposing
window.__reflexbefore the first render) was closed by the maintainer in favour of fixing it on the enterprise side, reflex-dev/reflex-enterprise#273 (dropping the render-timetypeof __reflexdependency informatColumnDefs), so the useEffect assignment in reflex stays as is. The core-only repro inprerelease_testing/2026-10-07/ent_grid/verification/(a user component that readswindow.__reflexduring render on a prerendered prod route) therefore remains as-is behaviour; the enterprise issue is reflex-dev/reflex-enterprise#260.Generated by Claude Code