File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed
docs/components/xiao/playground Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -211,7 +211,9 @@ export const createEditor = async ({
211211 ?. getValue ( )
212212
213213 if ( value !== undefined ) onChange ( value )
214- } , 200 ) as any as number
214+ // 1 / (average dev wpm * average English characters in a word / 60 secs in min) + single frame delay of 1/120
215+ // 1 / (60 * 4.79 / 60) + 0.08
216+ } , 288 ) as any as number
215217 } )
216218
217219 // const parent = placeholder.parentElement!
Original file line number Diff line number Diff line change @@ -118,30 +118,38 @@ onUnmounted(() => {
118118
119119const run = () => store .run ()
120120
121+ // This doesn't need a high debounce
122+ // The editor itself already debounced the input
123+ // Just a single frame of 1/120 to avoid accidental
124+ // state sync if infinite loops occurs
125+ // so it doesn't freeze the tab
121126watchDebounced (
122127 () => store .code ,
123128 () => {
124129 store .run ({ test: true })
125130 },
126131 {
127- debounce: 300
132+ debounce: 8
128133 }
129134)
135+
130136watch (() => store .input .method , run )
131137watchDebounced (() => store .input .path , run , {
132138 debounce: 300
133139})
134140watchDebounced (() => store .input .body , run , {
141+ // Preview is hidden between body editor
142+ // High debounce is ok since user can't see the result immediately
135143 debounce: 500
136144})
137145
138146// headers and cookie are already debounced by table editor
139147watchDebounced (() => store .input .headers , run , {
140- debounce: 10 ,
148+ debounce: 8 ,
141149 deep: true
142150})
143151watchDebounced (() => store .input .cookie , run , {
144- debounce: 10 ,
152+ debounce: 8 ,
145153 deep: true
146154})
147155 </script >
You can’t perform that action at this time.
0 commit comments