Commit 4b058a8
committed
fix(Map): sync with ChatGPT displayMode for automatic collapse
Fixes display mode synchronization bug where clicking ChatGPT's X button
didn't collapse the Map component back to compact view.
Changes:
- Add useDisplayMode() hook to listen to ChatGPT's display mode changes
- Sync internal fullscreen state when ChatGPT displayMode changes
- Only sync in uncontrolled mode (respects external state management)
- Update Storybook docs to document display mode sync behavior
Implementation:
- Uses useEffect to detect displayMode changes from 'fullscreen' to 'inline'
- Automatically updates internalIsFullscreen state to match
- Two-way sync: widget responds to both internal and external display mode changes
Result:
- Clicking ChatGPT's X button now properly collapses map to compact view
- No manual reset needed
- Follows Album component pattern for ChatGPT Apps SDK integration1 parent 6bc4fe4 commit 4b058a8
File tree
3 files changed
+32
-2
lines changed- packages/ui/src
- components/Map
- gallery/examples
3 files changed
+32
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
80 | 81 | | |
81 | 82 | | |
82 | 83 | | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
83 | 87 | | |
84 | 88 | | |
85 | 89 | | |
86 | 90 | | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
87 | 101 | | |
88 | 102 | | |
89 | 103 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
491 | 491 | | |
492 | 492 | | |
493 | 493 | | |
494 | | - | |
| 494 | + | |
495 | 495 | | |
496 | 496 | | |
497 | 497 | | |
498 | 498 | | |
499 | 499 | | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
500 | 507 | | |
501 | 508 | | |
502 | 509 | | |
| |||
552 | 559 | | |
553 | 560 | | |
554 | 561 | | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
555 | 566 | | |
556 | 567 | | |
557 | 568 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
420 | 420 | | |
421 | 421 | | |
422 | 422 | | |
423 | | - | |
| 423 | + | |
| 424 | + | |
424 | 425 | | |
425 | 426 | | |
426 | 427 | | |
| |||
479 | 480 | | |
480 | 481 | | |
481 | 482 | | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
482 | 487 | | |
483 | 488 | | |
484 | 489 | | |
| |||
0 commit comments