[pull] main from tldraw:main#598
Merged
Merged
Conversation
Closes #8892 (partial — focused fix; no `EditorManager` base class or full manager sweep). I've had some more ideas for a suitable way to keep having the Editor being the event emitter bus with every "managers" owning their events, it has been spiked in #9204 ## Summary - `InputsManager` now subscribes to the editor's `frame` event and tears down its own listener in `dispose()`. - `TickManager` no longer hard-codes `editor.inputs.updatePointerVelocity()`; it only drives the clock and emits `frame` / `tick`. - `Editor.dispose()` calls `removeAllListeners()` after emitting `dispose`, and the strict-mode camera workaround is simplified to `_setCameraState('idle')` only. ## Why Issue #8892 flagged asymmetric lifecycle: `TickManager` drove updates but didn't own the listeners they triggered. This moves pointer velocity into a normal frame subscription owned by `InputsManager`, and centralizes dispose-time listener cleanup on the editor. The load-bearing strict-mode fix is resetting persisted `cameraState` to `'idle'` when the editor is disposed — leftover tick listeners on a dead editor instance were never the real bug. ## Test plan - [x] `cd packages/editor && yarn test run TickManager InputsManager` - [x] `cd packages/tldraw && yarn test run HandTool Editor setCamera` - [x] `yarn workspace @tldraw/editor build-api` (no public API change on `InputsManager`) ### API changes - No public API changes for SDK consumers. - Added `@internal` `InputsManager.dispose()` to the API report. This is an editor lifecycle hook; do not call it from app code — use `editor.dispose()` instead. - `Editor.dispose()` now removes all event listeners after emitting `dispose`. Custom `editor.on(...)` handlers are cleared when the editor is torn down (expected for a disposed instance). ### Release notes - Fix camera state getting stuck at `moving` when the editor is disposed during camera movement (e.g. React strict mode with a shared store).
In order to ship the sidebar improvements with a reviewable history, this PR is a clean-history reimplementation of [`sidebar_improvements`](https://github.com/tldraw/tldraw/tree/sidebar_improvements). The final tree is identical to that branch; the work is re-split into focused commits so each step reads on its own. Review commit-by-commit. The change reworks the dotcom sidebar and the workspace model around it: - **Renameable home workspace** — the home/private workspace is now a normal, named workspace. Its name no longer mirrors the user's profile (migration `036` drops the name-sync trigger and defaults it to "My workspace"), and the mutator layer allows renaming it while keeping it private for invite/leave/delete/member actions. - **Sidebar redesign** — the workspace switcher becomes a dropdown plus dedicated action rows (new file, search, settings). The invite action moves out of the switcher and into the workspace settings dialog. - **Sidebar file search** — a new search action filters the file list as you type, with match highlighting and an empty state. - **File "Move to" checklist** — the menu now lists every workspace as a checkbox with the current one checked. - **Drag behavior** — dragging only reorders already-pinned files; dragging into the pinned section no longer pins (pinning happens through the menu). - **Dev tooling** — the dotcom dev stack uses a single fixed set of identifiers instead of per-branch ones, persisting local state across branch switches and self-healing leftover per-branch stacks that hold required ports. - **SDK** — `TldrawUiIcon` gains a `tiny` (12×12) size. ### Change type - [x] `feature` ### Test plan 1. Rename the home workspace from its settings dialog; confirm it persists and the sidebar reflects the new name. 2. Open the sidebar search, type a query, and confirm the file list filters with matches highlighted and a "No files found" empty state. 3. Use a file's "Move to" menu; confirm every workspace appears as a checkbox with the current one checked. 4. Copy a workspace invite link from the workspace settings dialog. 5. Drag a pinned file to reorder it; drag an unpinned file into the pinned section and confirm it does not pin. - [x] Unit tests - [x] End to end tests ### API changes - Added `tiny` prop to `TLUiIconProps` / `TldrawUiIcon` for a 12×12 icon size. ### Release notes - Make the home workspace a normal, renameable workspace. - Redesign the dotcom sidebar with a workspace switcher, dedicated action rows, and file search. - Move the workspace invite link into the workspace settings dialog. - Show the file "Move to" menu as a checklist of every workspace. ### Code changes | Section | LOC change | | --------------- | ------------ | | Core code | +24 / -6 | | Tests | +175 / -144 | | Automated files | +2 / -0 | | Apps | +970 / -612 |
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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )