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: add devmode warning for removing fragment markers #1541

Merged
merged 2 commits into from Apr 8, 2020

Conversation

mlrawlings
Copy link
Member

@mlrawlings mlrawlings commented Apr 8, 2020

Description

This adds additional checks in dev mode to give more context to the user as to why diffing failed when the DOM has been updated manually and fragment markers (empty text nodes) were removed.

Instead of throwing TypeError: Cannot read property 'nextSibling' of null, it now throws Error: Cannot get fragment nodes. Boundary markers missing.. In addition to the new error text, a second error is passed to console.warn showing the location where the fragment marker was removed.

image

Checklist:

  • I have read the CONTRIBUTING document and have signed (or will sign) the CLA.
  • I have updated/added documentation affected by my changes.
  • I have added tests to cover my changes.

@codecov
Copy link

codecov bot commented Apr 8, 2020

Codecov Report

Merging #1541 into master will decrease coverage by 0.05%.
The diff coverage is 62.50%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1541      +/-   ##
==========================================
- Coverage   90.58%   90.52%   -0.06%     
==========================================
  Files         356      356              
  Lines       12707    12731      +24     
==========================================
+ Hits        11510    11525      +15     
- Misses       1197     1206       +9     
Impacted Files Coverage Δ
...kages/marko/src/runtime/components/util-browser.js 89.01% <42.85%> (-8.40%) ⬇️
...ckages/marko/src/runtime/vdom/morphdom/fragment.js 93.47% <66.66%> (-1.88%) ⬇️
packages/marko/src/runtime/components/util.js 92.30% <100.00%> (+1.00%) ⬆️
packages/marko/src/runtime/vdom/morphdom/index.js 98.09% <100.00%> (+0.02%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 13bddd6...b977bf8. Read the comment docs.

@mlrawlings mlrawlings merged commit 1c3852f into master Apr 8, 2020
@DylanPiercey DylanPiercey deleted the fragment-marker-warning branch April 10, 2020 19:58
DylanPiercey pushed a commit that referenced this pull request Apr 13, 2020
DylanPiercey pushed a commit that referenced this pull request Apr 13, 2020
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.

None yet

2 participants