Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data Tracing: be able to trace const { myData } = useLoaderData(); and others #5646

Open
balazsbajorics opened this issue May 9, 2024 · 0 comments · Fixed by #5483
Open
Assignees
Labels
Code / Parsing Something related to our reading or writing of code

Comments

@balazsbajorics
Copy link
Contributor

The current code for finding a destructure / object binding statement is a temporary stopgap.

Sean already started working on #5483 which adds the necessary parsing to object bindings.

Whoever takes this ticket needs to verify that #5483 provides the information what we need, and then has to write a processing function similar to processJSPropertyAccessors which takes the reference to a parsed object binding statement, and returns a DataPath fragment we can use to continue our lookup.

DO NOT FORGET about the various ways the object binding assignment can drill into props and rename fields.

Some scary examples we will want to support:
const { a, b, ...rest } = obj;
const [a, b, ...rest] = array; // yes, arrays, hook use is FULL of array destructures, such as the humble const [state, setState] = React.useState()

What we do not need to support: default values
const { a: a1 = aDefault, b = bDefault } = obj;

This is essentially branching code which is currently fully out of scope for the data tracing.

@maltenuhn maltenuhn added the Code / Parsing Something related to our reading or writing of code label May 9, 2024
@balazsbajorics balazsbajorics linked a pull request May 13, 2024 that will close this issue
2 tasks
@maltenuhn maltenuhn added this to the 3. Dynamic Data milestone May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Code / Parsing Something related to our reading or writing of code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants