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

fix: index undefined in leaf's key #279

Closed
wants to merge 1 commit into from
Closed

fix: index undefined in leaf's key #279

wants to merge 1 commit into from

Conversation

atharva3010
Copy link
Contributor

No description provided.

@justin-schroeder
Copy link
Member

justin-schroeder commented Oct 7, 2020

Close, although we have a failing test on this for mutating the schema. This fixed my dumb bug of not having the index there, but I think the issue is we can't actually use the index here...grrr. the only way to make this work perfectly (i think) is to hash/collapse any children and include that in the key. That way if youre not changing content, using index is safe, but if you are changing content it will re-hydrate. This will certainly cause performance issues though, so im open to other suggestions too.

Deterministic auto-generated unique ids that dont use an index are just really hard. Technically they're impossible if we dont account for content

@atharva3010
Copy link
Contributor Author

Deterministic auto-generated unique ids that dont use an index are just really hard. Technically they're impossible if we dont account for content

How so?
Btw, what is the need of including an index here? Can't we just use a random uuid?

@justin-schroeder
Copy link
Member

normally this problem bites us and we cannot use randoms because they are used for id attribute and that breaks SSR re-hydration (like on Nuxt). Its a common problem (see: facebook/react#5867) but in this case since we're not using these keys as ids we might be able to get away with not even providing a key for non-formulate items. We definitely need a unique key for formulate inputs though.

@justin-schroeder
Copy link
Member

This is now fixed in the release/2.5 branch

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.

2 participants