Commit 07bf56a
ENG-1508: Open canvas as TldrawView immediately after creation (#892)
When a new canvas file is created, metadataCache.getFileCache() returns
null in the file-open handler because the cache hasn't indexed the new
file yet. This caused the file path to never be added to
pendingCanvasSwitches, so the active-leaf-change handler never switched
to TldrawView — leaving the user staring at raw JSON markdown.
Fix: directly call leaf.setViewState with VIEW_TYPE_TLDRAW_DG_PREVIEW
after openFile in createCanvas(), bypassing the event-based mechanism
for the creation case.
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent 8cc5189 commit 07bf56a
1 file changed
Lines changed: 6 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
178 | 179 | | |
179 | 180 | | |
180 | 181 | | |
181 | | - | |
182 | | - | |
| 182 | + | |
183 | 183 | | |
184 | 184 | | |
185 | 185 | | |
| |||
193 | 193 | | |
194 | 194 | | |
195 | 195 | | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
196 | 200 | | |
197 | 201 | | |
198 | 202 | | |
| |||
0 commit comments