Commit a96e264
refactor(gxt-backend): graduate __gxtIsRendering predicate to compilePipeline.isRendering bridge (Cluster B slice 19)
Promotes the render-pass-depth read-side predicate
(`__gxtIsRendering`) to a typed `compilePipeline.isRendering(): boolean`
method on the gxt-bridge. The single writer is `__gxtSetIsRendering`
(also defined in `compile.ts`, mutated cross-package from
`glimmer/lib/renderer.ts:2236/2272/2283`); it remains on globalThis in
this slice — a future slice 20 can promote the writer to a paired
begin/end (or `withRendering(fn)`) helper.
Writer + reader audit (pre-slice-19):
Writer (1):
- `compile.ts:_gxtSetIsRendering` — increment on `true`, decrement
on `false`. Mutates the module-local `_renderPassDepth` counter
that backs both `__gxtIsRendering` and `_gxtIsRendering`. Called
from `glimmer/lib/renderer.ts:2236/2272/2283` via globalThis
(cross-package writer; renderer wraps each `template.render()`
with `setIsRendering(true)` + restore in `try/finally`).
Readers (4):
- `compile.ts:1903` ($_inElement render-pass detect for deferred
in-element renders). MIGRATED to intra-file `_gxtIsRendering()`.
- `compile.ts:2130` ($_inElement self-insert heuristic for in-
element rendering into an empty target). MIGRATED to intra-file
`_gxtIsRendering()`.
- `glimmer/lib/renderer.ts:2233/2271` (renderComponent's
`wasRendering` save-restore + inner `_doRender` reactor's
`wasRenderingLocal` check — line 2271 captures the same
`_isRendering` closure variable as line 2233, so a single edit
at line 2233 propagates). MIGRATED to
`compilePipeline.isRendering()` bridge call with globalThis
fallback.
- `@ember/object/core.ts:321` (DEBUG proxy trap `_isInternalPath`
predicate). NOT migrated in this slice — the trap reads three
globalThis flags together (`__gxtIsRendering`, `__gxtSyncing`,
`__gxtInTriggerReRender`); migrating only one would not improve
the edge count net. Slice 18 deferred the same trap for its own
`__gxtInTriggerReRender` reader. Suggested slice 20 migrates
the whole 3-flag predicate at once.
Bridge shape decision: single read-only predicate `isRendering():
boolean` mirroring slice-18's `isInTriggerReRender()`. The writer
(`_gxtSetIsRendering`) is paired begin/end via cross-package callers
in `glimmer/lib/renderer.ts`, not a `withRendering(fn)` save-restore
helper. Promoting the writer to a paired begin/end bridge surface is
a separate concern (and touches the cross-package renderer.ts writer
site) — deferred to slice 20.
Namespace decision: `compilePipeline`. The flag is semantically a
scope-modifier on the GXT template render pipeline — the writer +
depth counter live in `compile.ts` (the pipeline's home file), the
intra-package readers are in `$_inElement` rendering helpers, and the
cross-package reader in `glimmer/lib/renderer.ts` is the renderer's
wrap of `template.render()`. Same namespace as slices 15/17/18.
Bridge interface evolution (slice 19 — fourteenth API change):
`GxtCompilePipelineCapabilities` extended with one new optional method:
- `isRendering?(): boolean`
No new install API needed (reuses slice-6's `installCompilePipelinePart`).
Sites moved:
- packages/@ember/-internals/gxt-backend/compile.ts: promote
`_renderPassDepth` and the two functions
(`_gxtIsRendering` / `_gxtSetIsRendering`) to module-local scope
(previously closure-locals inside the `if (typeof
__gxtIsRendering !== 'function')` guard); preserve the dual-load
guard around the globalThis writers; migrate the two intra-file
readers ($_inElement render-pass detect at 1903 and self-insert
heuristic at 2130) to direct `_gxtIsRendering()` calls; contribute
`isRendering: _gxtIsRendering` via `installCompilePipelinePart`.
- packages/@ember/-internals/gxt-backend/gxt-bridge.ts: add
`isRendering?(): boolean` to `GxtCompilePipelineCapabilities`
with slice-19 doc comments covering the writer + reader audit and
the unmigrated `@ember/object/core.ts:321` reader.
- packages/@ember/-internals/glimmer/lib/renderer.ts: route the
`_isRendering` capture in renderComponent (line 2233) through
`getGxtRenderer()?.compilePipeline.isRendering` with globalThis
fallback. The inner `_doRender` reactor's `wasRenderingLocal`
check (line 2271 / now 2285) captures the same `_isRendering`
closure variable, so the single edit propagates.
The `__gxtIsRendering` globalThis writer is RETAINED post-slice-19
because of the unmigrated `@ember/object/core.ts:321` reader. Both
the bridge predicate and the globalThis function reference the same
module-local `_renderPassDepth` counter — they are equivalent post-
install.
Hot-path note: `_gxtIsRendering` is `return _renderPassDepth > 0` —
one integer comparison; zero allocations. The bridge route in
renderer.ts adds one property lookup per `renderComponent` call —
not a tight loop. Intra-compile.ts readers in $_inElement use the
direct function call (no bridge indirection) which is strictly faster
than the pre-slice-19 globalThis lookup.
Verification (all 6 baseline gates green):
- smoke: 333/333
- Errors thrown during render: 4/4
- Tracked Properties: 33/36 (baseline)
- computed: 147/148 (baseline)
- Lifecycle: 40/42 (baseline)
- render: 977/981 (baseline)
Count delta: +1 bridge method (`isRendering`); 0 globalThis writers
removed (writer retained for unmigrated core.ts reader); 0 new
import edges (renderer.ts already imports `getGxtRenderer`; intra-
compile.ts readers use module-local function). Cumulative across
Cluster B: 19 slices migrated, bridge API evolved 14 times.
Suggested slice 20: migrate the `@ember/object/core.ts:321-326`
DEBUG proxy trap `_isInternalPath` predicate as a unit. The trap
reads three globalThis flags together (`__gxtIsRendering`,
`__gxtSyncing`, `__gxtInTriggerReRender`) — migrating them
individually has been deferred across slices 18 and 19 because the
edge-count math doesn't improve. A focused slice 20 can either
(a) add a single composite predicate `isInGxtInternalPath(propName):
boolean` to the bridge, or (b) add the missing `isSyncing()`
predicate and have core.ts call all three bridge predicates (which
also enables migrating the `__gxtSyncing` writer separately). After
slice 20 closes the trap, slice 21 can promote `__gxtSetIsRendering`
to a paired `beginRendering()/endRendering()` (or `withRendering(fn)`)
bridge writer surface, dropping the globalThis writer entirely.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent f3379b9 commit a96e264
3 files changed
Lines changed: 146 additions & 32 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2229 | 2229 | | |
2230 | 2230 | | |
2231 | 2231 | | |
| 2232 | + | |
| 2233 | + | |
| 2234 | + | |
| 2235 | + | |
| 2236 | + | |
| 2237 | + | |
| 2238 | + | |
| 2239 | + | |
| 2240 | + | |
| 2241 | + | |
2232 | 2242 | | |
2233 | | - | |
| 2243 | + | |
| 2244 | + | |
| 2245 | + | |
| 2246 | + | |
| 2247 | + | |
2234 | 2248 | | |
2235 | 2249 | | |
2236 | 2250 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1713 | 1713 | | |
1714 | 1714 | | |
1715 | 1715 | | |
1716 | | - | |
1717 | | - | |
1718 | | - | |
1719 | | - | |
1720 | | - | |
1721 | | - | |
1722 | | - | |
1723 | | - | |
1724 | | - | |
1725 | | - | |
1726 | | - | |
1727 | | - | |
1728 | | - | |
1729 | | - | |
1730 | | - | |
1731 | | - | |
1732 | | - | |
1733 | | - | |
1734 | | - | |
1735 | | - | |
| 1716 | + | |
| 1717 | + | |
| 1718 | + | |
| 1719 | + | |
| 1720 | + | |
| 1721 | + | |
| 1722 | + | |
| 1723 | + | |
| 1724 | + | |
| 1725 | + | |
| 1726 | + | |
| 1727 | + | |
| 1728 | + | |
| 1729 | + | |
| 1730 | + | |
| 1731 | + | |
| 1732 | + | |
| 1733 | + | |
| 1734 | + | |
| 1735 | + | |
| 1736 | + | |
| 1737 | + | |
| 1738 | + | |
| 1739 | + | |
| 1740 | + | |
| 1741 | + | |
| 1742 | + | |
| 1743 | + | |
| 1744 | + | |
| 1745 | + | |
| 1746 | + | |
| 1747 | + | |
| 1748 | + | |
| 1749 | + | |
| 1750 | + | |
| 1751 | + | |
| 1752 | + | |
| 1753 | + | |
1736 | 1754 | | |
1737 | 1755 | | |
1738 | | - | |
1739 | | - | |
1740 | | - | |
1741 | | - | |
| 1756 | + | |
| 1757 | + | |
| 1758 | + | |
| 1759 | + | |
| 1760 | + | |
1742 | 1761 | | |
1743 | 1762 | | |
1744 | 1763 | | |
| |||
1894 | 1913 | | |
1895 | 1914 | | |
1896 | 1915 | | |
1897 | | - | |
| 1916 | + | |
1898 | 1917 | | |
1899 | 1918 | | |
1900 | 1919 | | |
1901 | 1920 | | |
1902 | 1921 | | |
1903 | | - | |
1904 | | - | |
1905 | | - | |
| 1922 | + | |
| 1923 | + | |
| 1924 | + | |
| 1925 | + | |
| 1926 | + | |
1906 | 1927 | | |
1907 | 1928 | | |
1908 | 1929 | | |
| |||
2127 | 2148 | | |
2128 | 2149 | | |
2129 | 2150 | | |
2130 | | - | |
| 2151 | + | |
| 2152 | + | |
| 2153 | + | |
2131 | 2154 | | |
2132 | 2155 | | |
2133 | 2156 | | |
| |||
2144 | 2167 | | |
2145 | 2168 | | |
2146 | 2169 | | |
2147 | | - | |
2148 | | - | |
| 2170 | + | |
2149 | 2171 | | |
2150 | 2172 | | |
2151 | 2173 | | |
| |||
14379 | 14401 | | |
14380 | 14402 | | |
14381 | 14403 | | |
| 14404 | + | |
| 14405 | + | |
| 14406 | + | |
| 14407 | + | |
| 14408 | + | |
| 14409 | + | |
| 14410 | + | |
| 14411 | + | |
| 14412 | + | |
14382 | 14413 | | |
14383 | 14414 | | |
14384 | 14415 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
851 | 851 | | |
852 | 852 | | |
853 | 853 | | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
854 | 923 | | |
855 | 924 | | |
856 | 925 | | |
| |||
0 commit comments