Skip to content

Commit e31beee

Browse files
committed
fix(compiler): preserve derived-state kind across parameter defaults
Add 'derived-state' to the list of binding kinds preserved when a callee parameter has a default value, alongside 'prop' and 'snapshot'. Without this, a derived-state argument (e.g. `apply(n + 1)`) passed to a parameter with a default was downgraded to 'other', causing checkStaleUpdate to miss the state provenance.
1 parent 7d11680 commit e31beee

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎packages/octane/src/compiler/strong-mode.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2309,7 +2309,7 @@ export function analyzeStrongMode(ast, source, filename, options = {}) {
23092309
// A default replaces only `undefined`; otherwise the parameter is the
23102310
// state value the updater, reducer, or helper received.
23112311
value =
2312-
value?.kind === 'prop' || value?.kind === 'snapshot'
2312+
value?.kind === 'prop' || value?.kind === 'snapshot' || value?.kind === 'derived-state'
23132313
? value
23142314
: value.kind === 'constant' && value.primitive === undefined
23152315
? defaultValue

0 commit comments

Comments
 (0)