Data Tracing: be able to trace const { myData } = useLoaderData(); and others #5646
Labels
Code / Parsing
Something related to our reading or writing of code
Milestone
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 humbleconst [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.
The text was updated successfully, but these errors were encountered: