Commit 2afa284
Fix widget routing infinite loop and room switching
Three critical fixes for widget routing:
1. Infinite loop prevention (MainWidget.ts)
- Add guard to switchContentView() tracking currentViewType/entityId
- Skip re-render when already showing the same content
- Prevents cascading events from triggering infinite widget recreation
2. Remove duplicate event emission (RoomListWidget.ts)
- Remove direct content:opened emit from selectRoom()
- The collaboration/content/open command already emits with proper contentItemId
- Reduces event noise and potential race conditions
3. Critical pageState fix (MainWidget.ts)
- ROOM_SELECTED handler now calls pageState.setContent() BEFORE switchContentView()
- ChatWidget reads from pageState as priority 1, was loading stale room
- Now room switching correctly updates both tab AND chat content
Result: Clicking rooms in sidebar now properly switches tabs and content
without infinite loops or stale data.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>1 parent 00f3b0a commit 2afa284
File tree
6 files changed
+29
-15
lines changed- src/debug/jtag
- widgets
- chat/room-list
- main
6 files changed
+29
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
208 | 208 | | |
209 | 209 | | |
210 | 210 | | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
211 | 214 | | |
212 | 215 | | |
213 | 216 | | |
214 | 217 | | |
215 | 218 | | |
216 | 219 | | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | | - | |
| 220 | + | |
226 | 221 | | |
227 | 222 | | |
228 | 223 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
34 | 38 | | |
35 | 39 | | |
36 | 40 | | |
| |||
327 | 331 | | |
328 | 332 | | |
329 | 333 | | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
330 | 340 | | |
331 | 341 | | |
332 | 342 | | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
333 | 347 | | |
334 | 348 | | |
335 | 349 | | |
| |||
639 | 653 | | |
640 | 654 | | |
641 | 655 | | |
642 | | - | |
| 656 | + | |
643 | 657 | | |
644 | 658 | | |
645 | 659 | | |
| |||
656 | 670 | | |
657 | 671 | | |
658 | 672 | | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
659 | 678 | | |
660 | 679 | | |
661 | 680 | | |
| |||
0 commit comments