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 keys, normalize holes #2452

Merged
merged 3 commits into from Jul 3, 2019
Merged

Conversation

dead-claudia
Copy link
Member

Description

  • Require fragments to either have only keyed children or no keyed children.
  • Ban holes from keyed fragments, to reduce complexity in the keyed diff algorithm.
  • Normalize booleans, null, and undefined to be a single hole sentinel null, to simplify representation.
  • Document a common pattern on how to have a programmatically replaceable node, to resolve some confusion around that.

Motivation and Context

Closes #2434
Fixes #2248

Also resolves a class of paper cuts that have found their way onto Gitter the past several months with v1.

How Has This Been Tested?

Added a couple tests, updated a bunch, rewrote a few.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation change

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • I have updated docs/change-log.md

This brings a lot better consistency with that API, even though it's
slightly breaking. (I had to update a bunch of tests to correspond with
it.)
@project-bot project-bot bot added this to Needs triage in Triage/bugs Jul 3, 2019
@dead-claudia dead-claudia merged commit 6c562d2 into MithrilJS:next Jul 3, 2019
Triage/bugs automation moved this from Needs triage to Closed Jul 3, 2019
@dead-claudia dead-claudia deleted the fix-keys branch July 3, 2019 21:06
@ancms2600
Copy link

ancms2600 commented Sep 1, 2019

moved to: #2526
Feature Request: Normalize vnode.children passed to m() hypertext
(flatten arrays, omit null, undefined and false)

@dead-claudia
Copy link
Member Author

@ancmikesmullin Please file a new issue with that suggestion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

Re-define purpose of key attribute Forbid mixing keyed and non-keyed vnodes in the same array
2 participants