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
keep a tile's TileId when it gets wrapped in a container
Dropping a tile onto another tile wraps them both in a new container. That wrapper
used to take over the *target's* `TileId`, with the target itself moved to a
freshly allocated one. So a `TileId` did not keep referring to the same tile: an
id that meant "pane_a" one frame meant "the container holding pane_a" the next.
That is a trap for any application that keys its own state off `TileId`s -- which
Rerun does, and which `examples/tree_recreated_every_frame.rs` demonstrates. Such
an app maps the id back to its own model, gets told a container now lives where a
pane used to, and reuses the pane's identity for it. Next frame it builds a tree
with a pane and a container at the same id, one overwrites the other, and a pane
disappears.
Now the wrapped tile keeps its id and the new container gets the fresh one. The
wrapper also inherits what the wrapped tile had by virtue of its position: its
share of a linear container's space, its cell in a grid, and whether it was the
open tab. Whoever referenced the wrapped tile is re-pointed at the wrapper, and
since `Tiles` does not know the root, `insert_at` hands the new container back so
`Tree` can re-point the root when it was the root that got wrapped.
Verified by restoring the naive version of the example's model-sync -- the one
that lost panes -- and confirming the full drag sweep now passes with it. Kept the
tidier version regardless, since panes never needed to be in that map.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
0 commit comments