@@ -12,9 +12,15 @@ import {
1212 type RouterModels ,
1313 DEFAULT_CHECKPOINT_TIMEOUT_SECONDS ,
1414 DEFAULT_DIFF_FUZZY_THRESHOLD ,
15+ DEFAULT_WRITE_DELAY_MS ,
1516} from "@roo-code/types"
1617
17- import { ExtensionStateContextProvider , useExtensionState , mergeExtensionState } from "../ExtensionStateContext"
18+ import {
19+ ExtensionStateContextProvider ,
20+ useExtensionState ,
21+ mergeExtensionState ,
22+ createInitialExtensionState ,
23+ } from "../ExtensionStateContext"
1824
1925const TestComponent = ( ) => {
2026 const { allowedCommands, setAllowedCommands, soundEnabled, showRooIgnoredFiles, setShowRooIgnoredFiles } =
@@ -215,6 +221,16 @@ describe("ExtensionStateContext", () => {
215221 expect ( JSON . parse ( screen . getByTestId ( "show-rooignored-files" ) . textContent ! ) ) . toBe ( true )
216222 } )
217223
224+ it ( "initializes the write delay to the pre-hydration default" , ( ) => {
225+ // The initializer itself (not a merge fixture) must carry the shared
226+ // default: a regression that dropped it from createInitialExtensionState
227+ // would otherwise stay hidden because the merge tests supply the key
228+ // manually.
229+ const state = createInitialExtensionState ( )
230+
231+ expect ( state . writeDelayMs ) . toBe ( DEFAULT_WRITE_DELAY_MS )
232+ } )
233+
218234 it ( "initializes shadowed context fields from initialState" , ( ) => {
219235 const routerModels = { } as RouterModels
220236 const marketplaceItems : MarketplaceItem [ ] = [
@@ -410,7 +426,9 @@ describe("mergeExtensionState", () => {
410426 taskHistory : [ ] ,
411427 shouldShowAnnouncement : false ,
412428 enableCheckpoints : true ,
413- writeDelayMs : 1000 ,
429+ // Matches the shared DEFAULT_WRITE_DELAY_MS (pre-hydration placeholder
430+ // must not disagree with the extension's own fallback).
431+ writeDelayMs : 0 ,
414432 mode : "default" ,
415433 experiments : { } as Record < ExperimentId , boolean > ,
416434 customModes : [ ] ,
@@ -480,7 +498,9 @@ describe("mergeExtensionState", () => {
480498 taskHistory : [ ] ,
481499 shouldShowAnnouncement : false ,
482500 enableCheckpoints : true ,
483- writeDelayMs : 1000 ,
501+ // Matches the shared DEFAULT_WRITE_DELAY_MS (pre-hydration placeholder
502+ // must not disagree with the extension's own fallback).
503+ writeDelayMs : 0 ,
484504 mode : "default" ,
485505 experiments : { } as Record < ExperimentId , boolean > ,
486506 customModes : [ ] ,
0 commit comments