Skip to content

Commit b98f159

Browse files
committed
fix(fws): export the webview initializer and test the pre-hydration checkpoint default
createInitialExtensionState is exported and a focused test asserts it initializes perWriteCheckpoints to true: a regression that dropped the key from the initializer (rather than from a merge fixture) would otherwise stay hidden (CodeRabbit finding on trial #1413).
1 parent abfbe7f commit b98f159

2 files changed

Lines changed: 17 additions & 2 deletions

File tree

‎webview-ui/src/context/ExtensionStateContext.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ export const mergeExtensionState = (prevState: ExtensionState, newState: Partial
196196
}
197197
}
198198

199-
const createInitialExtensionState = (): ExtensionState => ({
199+
export const createInitialExtensionState = (): ExtensionState => ({
200200
apiConfiguration: {},
201201
version: "",
202202
clineMessages: [],

‎webview-ui/src/context/__tests__/ExtensionStateContext.spec.tsx‎

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,12 @@ import {
1313
DEFAULT_DIFF_FUZZY_THRESHOLD,
1414
} from "@roo-code/types"
1515

16-
import { ExtensionStateContextProvider, useExtensionState, mergeExtensionState } from "../ExtensionStateContext"
16+
import {
17+
ExtensionStateContextProvider,
18+
useExtensionState,
19+
mergeExtensionState,
20+
createInitialExtensionState,
21+
} from "../ExtensionStateContext"
1722

1823
const TestComponent = () => {
1924
const { allowedCommands, setAllowedCommands, soundEnabled, showRooIgnoredFiles, setShowRooIgnoredFiles } =
@@ -396,6 +401,16 @@ describe("ExtensionStateContext", () => {
396401
}),
397402
)
398403
})
404+
405+
it("initializes the per-write checkpoint default before hydration", () => {
406+
// The initializer itself (not a merge fixture) must carry the per-write
407+
// checkpoint default: a regression that dropped it from
408+
// createInitialExtensionState would otherwise stay hidden because the
409+
// merge tests supply the key manually.
410+
const state = createInitialExtensionState()
411+
412+
expect(state.perWriteCheckpoints).toBe(true)
413+
})
399414
})
400415

401416
describe("mergeExtensionState", () => {

0 commit comments

Comments
 (0)