Skip to content

Conversation

@Aqil-Ahmad
Copy link

@Aqil-Ahmad Aqil-Ahmad commented Oct 24, 2025

Fixes tscircuit/tscircuit#1149
/claim tscircuit/tscircuit#1149

Problem

When using pcbPath with selectors, traces worked with regular footprints but failed with KiCad footprints loaded asynchronously

Root Cause

Selector queries were cached before async footprints loaded, returning null. Traces ran before port-to-pad matching completed after footprint loading

Solution

Clear selector caches when children are added/removed. mark connected traces dirty after async footprint loading and add update method for trace re-rendering after port matching

image

@vercel
Copy link

vercel bot commented Oct 24, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
tscircuit-core-benchmarks Ready Ready Preview Comment Oct 25, 2025 10:36am

@Aqil-Ahmad
Copy link
Author

@seveibar can you please review!

Copy link
Contributor

@seveibar seveibar left a comment

Choose a reason for hiding this comment

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

Too complex, lots of repeated code. Good first attempt

@Aqil-Ahmad
Copy link
Author

Aqil-Ahmad commented Oct 24, 2025

Too complex, lots of repeated code. Good first attempt

i will try to simplify it and remove the redundancies (maybe with helper functions)

)
})

test("trace pcbPath selectors work with regular footprints (baseline)", async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

remove

@seveibar
Copy link
Contributor

A bit complex still since you're relying on a rerender. Did you check if asyncPhaseDependencies can handle this? Seems to me like it would?

@seveibar
Copy link
Contributor

And don't test the baseline, there are hundreds of tests for that. Plus we have a rule one test per file

@Aqil-Ahmad
Copy link
Author

Aqil-Ahmad commented Oct 24, 2025

Did you check if asyncPhaseDependencies can handle this? Seems to me like it would?

you're right! but i think asyncPhaseDependencies alone wont work. this only checks a component's own tree. since R1 and trace are siblings, we will have to look from root - the render system itself would need to be modified.

@Aqil-Ahmad
Copy link
Author

Did you check if asyncPhaseDependencies can handle this? Seems to me like it would?

you're right! but i think asyncPhaseDependencies alone wont work. this only checks a component's own tree. since R1 and trace are siblings, we will have to look from root - the render system itself would need to be modified.

@seveibar what do you suggest?

@seveibar
Copy link
Contributor

i think asyncPhaseDependencies alone wont work. this only checks a component's own tree. since R1 and trace are siblings, we will have to look from root - the render system itself would need to be modified.

Hmm interesting, i think it should check the entire tree and look from root. The intent with those dependencies was to make the entire system wait and not let certain parts of the tree move forward.

There's an exception for subcircuits which are supposed to be able to independently render but we can ignore that for now

@seveibar
Copy link
Contributor

@Aqil-Ahmad nice insights

@seveibar
Copy link
Contributor

@Aqil-Ahmad you seem to understand the code pretty well, definitely reach out to me on discord if you're interested in doing more work together: https://tscircuit.com/join

@Aqil-Ahmad
Copy link
Author

Aqil-Ahmad commented Oct 25, 2025

Hmm interesting, i think it should check the entire tree and look from root. The intent with those dependencies was to make the entire system wait and not let certain parts of the tree move forward.

Hi @seveibar! can you please review. also should i add complete recursive tree check in RootCircuit as per your comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

selector resolution problem with kicad footprints

2 participants