Commit 398a0ed
committed
fix(sandpack): make Clear button actually reset the preview
When the Clear button reset edited files, it also called refresh()
synchronously. The refresh reboots the preview iframe while the
Sandpack client still holds the edited files, and the debounced file
sync carrying the reset files is lost in the reboot. The preview then
keeps running the edited code.
Only refresh when there was nothing to reset; after a confirmed reset,
let the file watcher push the original files so the bundler recompiles
the preview with them.
Fixes #86571 parent b011783 commit 398a0ed
1 file changed
Lines changed: 7 additions & 7 deletions
File tree
- src/components/MDX/Sandpack
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
| 113 | + | |
120 | 114 | | |
121 | 115 | | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
| |||
0 commit comments