Skip to content

Commit b0d96fe

Browse files
matej21claude
andcommitted
fix(repeater): pass render/form results to collectNested to prevent DCE
Rolldown (Vite 8 dep optimizer) strips function calls whose results are unused. Passing results to collectNested (an external callback parameter) prevents dead-code elimination and also properly analyzes returned JSX. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 1c7c702 commit b0d96fe

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

packages/bindx-repeater/src/components/BlockRepeater.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,10 +244,11 @@ blockRepeaterWithSelection.getSelection = (
244244
const syntheticChildren = props.children(mockItems, mockMethods)
245245
const jsxSelection = collectNested(syntheticChildren)
246246

247-
// Call block render/form functions so the collector proxy records field accesses
247+
// Call block render/form functions so the collector proxy records field accesses.
248+
// Results are passed to collectNested to prevent bundler dead-code elimination.
248249
for (const blockDef of Object.values(props.blocks) as BlockDefinition[]) {
249-
if (blockDef.render) blockDef.render(collectorEntity as EntityAccessor<object>)
250-
if (blockDef.form) blockDef.form(collectorEntity as EntityAccessor<object>)
250+
if (blockDef.render) collectNested(blockDef.render(collectorEntity as EntityAccessor<object>))
251+
if (blockDef.form) collectNested(blockDef.form(collectorEntity as EntityAccessor<object>))
251252
}
252253

253254
const nestedSelection = scope.toSelectionMeta()

0 commit comments

Comments
 (0)