Skip to content

[Fiber] Maps as keyed collections of children #8911

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

Closed
wants to merge 6 commits into from

Conversation

acdlite
Copy link
Collaborator

@acdlite acdlite commented Feb 2, 2017

I think I got the semantics right. The existing test coverage is scant, I guess because it's an experimental feature. (Should I add additional tests before landing?)

Instead of reading the key from the element/portal/coroutine, accept
the key as a parameter so that the caller override the key if needed.
E.g. for maps as children.
Typically these aren't keyed because there's no key on the child object.
But they are keyed if you use a Map.
Stack uses comment nodes to key text nodes, but Fiber doesn't. The
test now works regardless.
Maps have special semantics where the values are fragment children and
the keys are React keys.
Maps are still experimental. Warn the first time a map is used.
@sebmarkbage
Copy link
Collaborator

I think we should either decide to activate this feature or explicitly disable it in both Stack and Fiber.

Last time I was concerned that this pattern is confusing since it is overloaded with the keyed element pattern. It is also an inefficient pattern since it optimizes the set for quick key lookups which we normally don't need.

@acdlite
Copy link
Collaborator Author

acdlite commented Feb 6, 2017

Closing since we decided not to support this feature anymore. Will open a PR to remove it from Stack.

@acdlite acdlite closed this Feb 6, 2017
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.

3 participants