Skip to content

Conversation

@mathpirate
Copy link
Contributor

@mathpirate mathpirate commented Nov 4, 2025

Map closures – reuse shared helpers for computed aliases and restore stable derive inputs; update fixtures to reflect hierarchical params without runtime regressions.


Summary by cubic

Fixes hierarchical params and computed alias handling in map closures, and makes derive inputs stable by always passing object captures. Updates fixtures to match the consistent codegen and avoids runtime regressions.

  • Bug Fixes

    • Handle computed property aliases in map callbacks by emitting key vars and derive-based alias reads, preserving reactivity.
    • Always call derive with an object of captures; remove the single-arg shortcut for stable inputs.
    • Correct map params shape (element, index, params) and binding normalization; support outer element access and keys.
    • Ensure test copying creates destination directories before file writes.
  • Refactors

    • Add element binding analysis and computed alias collection; reuse capture access helper.
    • Improve identifier utilities to support astral Unicode characters and sanitize invalid fallbacks.
    • Centralize property/param name generation and binding/parameter helpers across transformers to deduplicate logic.
    • Extract a type traversal helper and use it for opaque-ref brand detection.

Written for commit 0a451ca. Summary will update automatically on new commits.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 20 files

Prompt for AI agents (all 1 issues)

Understand the root cause of the following 1 issues and fix them.


<file name="packages/ts-transformers/src/closures/transformer.ts">

<violation number="1" location="packages/ts-transformers/src/closures/transformer.ts:632">
When computed aliases exist, the callback parameter now loses any other destructured bindings (e.g., `{ foo }`), so those locals disappear after transformation. Please keep the original bindings alongside the alias handling.</violation>
</file>

React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.

);

return {
bindingName: elementIdentifier,
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Nov 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When computed aliases exist, the callback parameter now loses any other destructured bindings (e.g., { foo }), so those locals disappear after transformation. Please keep the original bindings alongside the alias handling.

Prompt for AI agents
Address the following comment on packages/ts-transformers/src/closures/transformer.ts at line 632:

<comment>When computed aliases exist, the callback parameter now loses any other destructured bindings (e.g., `{ foo }`), so those locals disappear after transformation. Please keep the original bindings alongside the alias handling.</comment>

<file context>
@@ -461,6 +466,331 @@ function normalizeBindingName(
+  );
+
+  return {
+    bindingName: elementIdentifier,
+    elementIdentifier,
+    computedAliases: aliasBucket,
</file context>
Fix with Cubic

@mathpirate mathpirate force-pushed the fix/hierarchical-params-followups branch from c9bc84a to bd012a7 Compare November 4, 2025 23:18
@mathpirate mathpirate force-pushed the fix/hierarchical-params-followups branch from ee8b951 to c3afc48 Compare November 5, 2025 18:09
@mathpirate mathpirate force-pushed the fix/hierarchical-params-followups branch from b6c65dc to 0a451ca Compare November 5, 2025 20:21
@mathpirate mathpirate merged commit 5eee7d6 into main Nov 5, 2025
8 checks passed
@mathpirate mathpirate deleted the fix/hierarchical-params-followups branch November 5, 2025 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants