fix: preserve order of link tags on HMR#982
Conversation
|
|
b9cf364 to
9f26ec5
Compare
|
Hi @alexander-akait , could you please have a look at this? |
|
@guansss Yeah, in my todo (just a lot of issues), will look tomorrow |
|
Can you update tests? Need to copy some files from |
|
OK, updated. |
|
Thank you |
|
Hmm, there was an extra blank line generated while running tests on my machine, not sure why. |
87c7c9a to
dd50dce
Compare
Codecov ReportBase: 90.37% // Head: 90.37% // No change to project coverage 👍
Additional details and impacted files@@ Coverage Diff @@
## master #982 +/- ##
=======================================
Coverage 90.37% 90.37%
=======================================
Files 5 5
Lines 831 831
Branches 222 222
=======================================
Hits 751 751
Misses 70 70
Partials 10 10
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
|
I have tested your solution with #959 and looks like it doesn't work, because order after HTML extraction is different |
|
Oops, the issue I expected to solve is #955, I linked a wrong one, sorry for wasting your time to test on it :( |
|
Updated files for old API test. |
This PR contains a:
Motivation / Use-Case
Resolves 959Resolves #955
Problem:
Say there are two CSS chunks in sequence: A and B, the generated link tags appear like:
When A is modified, the HMR handler will append its new link tag to
document.head, resulting in a different order:Now the order is incorrect - A's styles will override B's.
Solution:
Insert new link tag right after the old one, so that the result will be correct:
I had no clue on how to add a test for this, 🤔 so I just updated the manual test, hope that's valid.