You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Design: keep big boards responsive while selecting, zooming and panning - #10197
A batch of Design editor fixes for large boards: screens you're looking at always load, off-screen and overview screens stop animating, marquee selection and the layers panel stop doing per-move work that grows with node count, and the hot paths that scan whole screen HTML get cheaper.
What changes
1. Screens in view load past the byte budget. Source demand now reports inView (the previews on screen now, nearest first) next to pinned and preview. Hydration admits up to SOURCE_HYDRATION_MAX_IN_VIEW (16) of those regardless of the byte budget, so a few multi-megabyte screens nearby can't leave the one you're looking at as a gray placeholder. In-view sources don't count against the budget and are never evicted while in view. While the camera moves, the previous inView list is kept so panning doesn't churn it.
2. Animations pause where nobody is editing. The canvas sends set-animations-paused to each screen's iframes when the screen leaves the visible tier, or for every screen when zoom drops below 25% (overview). The focused interact screen is always exempt. Inside the frame this pauses CSS animations with a style, running Web Animations with pause(), SVG with pauseAnimations(), and stops the shader runtime's loop (it still draws one frame when a canvas scrolls into view). A frame that boots while its screen is paused gets the message on load.
3. Marquee selection without per-move re-renders. The marquee rectangle is written straight to the DOM during the drag instead of through state, which re-rendered the whole canvas every frame. Resolving hit layers no longer scans linearly: source ids get a per-projection index and ancestor chains are built once per tree, both in WeakMaps keyed by the array so a rebuilt projection gets fresh ones. A clear-selection request mid-drag is ignored, since the next move sets selection and rectangle again. Passive selection overlays now read every placement before writing any, so placing many overlays costs one layout. There's a new canvas-bench action for this:
4. Layers panel mounts only the rows near the viewport. Rows are windowed (12 rows of overscan, scroll position bucketed to 6 rows) with spacer divs above and below. The row being renamed and the row being dragged stay mounted. Selection for shift/cmd clicks is read from the row data instead of the DOM, and scroll-to-selected works for rows that aren't mounted. LayerGlyph is memoized on the fields it reads.
5. Selection measurement stops retrying pointless misses. The bridge's measure reply now carries ready (document finished loading). A loaded frame that says "not found" ends the retry loop right away; silence and not-yet-loaded frames still retry. Layer actions pass share: true, so concurrent first attempts for the same screen, selector and windows join one request. Re-measures after an edit don't share, so they never get the pre-edit size.
6. Editing-safety sync runs at most once per frame. The embedded-wheel bridge used to walk document.getAnimations() on every mutation batch, resize and gesture-mode message. Now mutations and resizes schedule one sync per animation frame, gesture-mode messages only sync when the flag flips, and managed motion names are cached until a stylesheet changes. Two gaps closed on the way: page script removing the freeze style re-syncs, and a managed (non-infinite) animation starting from :hover or similar also triggers a sync.
7. Cheaper scans of full screen HTML. Several paths run over multi-megabyte screen content on render or mount:
The tag scanner behind injectDocumentMarkup in core jumps between tags with sticky regexes instead of stepping characters. The spec checks it places markup exactly where the old character-by-character tokenizer did.
mayHaveFrameTypeMarker (HubSpot) no longer lowercases a copy of the whole screen.
sourceReferences matches attribute values with a negated class instead of a lazy .*?\1, which walked inlined data URLs one character at a time:
ensureNativeShaderRuntime and selectedNativeInstances skip parsing when the marker string isn't present, and the effects-manifest check in Screen is memoized.
8. Fewer canvas and chat re-renders. Zoom steps, source demand updates and the hydration revision bump run in startTransition. areScreenPropsEqual ignores renderBreakpointContent for screens without breakpoint frames, and the screen layer selection keeps its identity when the rect didn't change. ReviewCanvasPins only sets up its observers when it renders pins, and skips a re-render when a camera move left the canvas where it was. In the toolkit, adding or removing a chat context item without focusing the composer goes through a transition, so it no longer blocks the page.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
A critical scope-change bug can retain context chips from a previous thread or namespace and include them in the next message because the self-publication check skips re-filtering.
Visible screens with animated native fills continue scheduling and submitting GPU frames below 25% zoom because native-shader-runtime.bridge.ts does not handle set-animations-paused; its compact preview mode only throttles rendering. The new handler in shader-runtime.bridge.ts covers the legacy GLSL renderer, not the native-effects renderer. Add pause/resume handling to the native renderer and regenerate its bridge, preserving one-shot redraws.
Allow encoded native-effects markers through the manifest gate
This literal-string gate rejects valid manifests whose type attribute uses a character reference, such as type="application/x-agent-native-effects". parseEffectsFromHtml recognizes that decoded value, but this new early return hides its instances and definitions from the inspector. Keep the gate conservative by allowing possible encoded markers through to the parser, as the HubSpot marker gate already does.
If submission occurs while this transition is pending, the send paths still read committed contextItems/visibleContextItems and can send the previous selection instead of the newly staged context. The removal transition at line 4886 can likewise send an item that was just removed. Snapshot submission context from synchronous, scoped state—including provider-owned items—and defer only its visual rendering.
Accept character references in supported manifest types
The literal gate skips valid manifests such as type="application/x-agent-native-effects", which the HTML parser decodes to the supported manifest type. Their effects disappear from the inspector because parsing is skipped. Conservatively allow content containing character references through the gate; an extra parse is preferable to hiding an existing effect.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Context cleanup can delete unsent or restaged items during asynchronous preparation, and the pause bridge fails to pause newly created Web Animations and SVG roots.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The chat send path can transmit removed or outdated context and delete an unsent replacement because sent content and cleanup identities can come from different versions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A batch of Design editor fixes for large boards: screens you're looking at always load, off-screen and overview screens stop animating, marquee selection and the layers panel stop doing per-move work that grows with node count, and the hot paths that scan whole screen HTML get cheaper.
What changes
1. Screens in view load past the byte budget. Source demand now reports
inView(the previews on screen now, nearest first) next topinnedandpreview. Hydration admits up toSOURCE_HYDRATION_MAX_IN_VIEW(16) of those regardless of the byte budget, so a few multi-megabyte screens nearby can't leave the one you're looking at as a gray placeholder. In-view sources don't count against the budget and are never evicted while in view. While the camera moves, the previousinViewlist is kept so panning doesn't churn it.2. Animations pause where nobody is editing. The canvas sends
set-animations-pausedto each screen's iframes when the screen leaves the visible tier, or for every screen when zoom drops below 25% (overview). The focused interact screen is always exempt. Inside the frame this pauses CSS animations with a style, running Web Animations withpause(), SVG withpauseAnimations(), and stops the shader runtime's loop (it still draws one frame when a canvas scrolls into view). A frame that boots while its screen is paused gets the message on load.3. Marquee selection without per-move re-renders. The marquee rectangle is written straight to the DOM during the drag instead of through state, which re-rendered the whole canvas every frame. Resolving hit layers no longer scans linearly: source ids get a per-projection index and ancestor chains are built once per tree, both in
WeakMaps keyed by the array so a rebuilt projection gets fresh ones. A clear-selection request mid-drag is ignored, since the next move sets selection and rectangle again. Passive selection overlays now read every placement before writing any, so placing many overlays costs one layout. There's a new canvas-bench action for this:4. Layers panel mounts only the rows near the viewport. Rows are windowed (12 rows of overscan, scroll position bucketed to 6 rows) with spacer divs above and below. The row being renamed and the row being dragged stay mounted. Selection for shift/cmd clicks is read from the row data instead of the DOM, and scroll-to-selected works for rows that aren't mounted.
LayerGlyphis memoized on the fields it reads.5. Selection measurement stops retrying pointless misses. The bridge's measure reply now carries
ready(document finished loading). A loaded frame that says "not found" ends the retry loop right away; silence and not-yet-loaded frames still retry. Layer actions passshare: true, so concurrent first attempts for the same screen, selector and windows join one request. Re-measures after an edit don't share, so they never get the pre-edit size.6. Editing-safety sync runs at most once per frame. The embedded-wheel bridge used to walk
document.getAnimations()on every mutation batch, resize and gesture-mode message. Now mutations and resizes schedule one sync per animation frame, gesture-mode messages only sync when the flag flips, and managed motion names are cached until a stylesheet changes. Two gaps closed on the way: page script removing the freeze style re-syncs, and a managed (non-infinite) animation starting from:hoveror similar also triggers a sync.7. Cheaper scans of full screen HTML. Several paths run over multi-megabyte screen content on render or mount:
injectDocumentMarkupin core jumps between tags with sticky regexes instead of stepping characters. The spec checks it places markup exactly where the old character-by-character tokenizer did.mayHaveFrameTypeMarker(HubSpot) no longer lowercases a copy of the whole screen.sourceReferencesmatches attribute values with a negated class instead of a lazy.*?\1, which walked inlined data URLs one character at a time:ensureNativeShaderRuntimeandselectedNativeInstancesskip parsing when the marker string isn't present, and the effects-manifest check inScreenis memoized.8. Fewer canvas and chat re-renders. Zoom steps, source demand updates and the hydration revision bump run in
startTransition.areScreenPropsEqualignoresrenderBreakpointContentfor screens without breakpoint frames, and the screen layer selection keeps its identity when the rect didn't change.ReviewCanvasPinsonly sets up its observers when it renders pins, and skips a re-render when a camera move left the canvas where it was. In the toolkit, adding or removing a chat context item without focusing the composer goes through a transition, so it no longer blocks the page.