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: js exception when reloading async chunk (#444) #531

Closed
wants to merge 3 commits into from

Conversation

Rulexec
Copy link

@Rulexec Rulexec commented May 22, 2020

This PR contains a:

  • bugfix
  • new feature
  • code refactor
  • test update
  • typo fix
  • metadata update

Motivation / Use-Case

HMR throws exception every time when I do edits in my css files:

Uncaught TypeError: Cannot read property 'some' of null
    at getReloadUrl (hotModuleReplacement.js:129)
    at hotModuleReplacement.js:145
    at NodeList.forEach (<anonymous>)
    at reloadStyle (hotModuleReplacement.js:140)
    at update (hotModuleReplacement.js:194)
    at functionCall (hotModuleReplacement.js:24)

This fix ignores such obviously wrong updates and allows to use options.reloadAll, because this exception happens just before reloadAll() call.

Issue — #444

Breaking Changes

None.

@jsf-clabot
Copy link

jsf-clabot commented May 22, 2020

CLA assistant check
All committers have signed the CLA.

Copy link
Member

@alexander-akait alexander-akait left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a test

@alexander-akait
Copy link
Member

Or please create reproducible test repo

@Rulexec
Copy link
Author

Rulexec commented May 26, 2020

Reproducible test branch.

I will try to write test, but it can take a while to investigate, how to write such test.

@codecov
Copy link

codecov bot commented Jun 18, 2020

Codecov Report

Merging #531 into master will increase coverage by 0.33%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #531      +/-   ##
==========================================
+ Coverage   88.49%   88.83%   +0.33%     
==========================================
  Files           5        5              
  Lines         426      430       +4     
  Branches       94       95       +1     
==========================================
+ Hits          377      382       +5     
+ Misses         47       46       -1     
  Partials        2        2              
Impacted Files Coverage Δ
src/hmr/hotModuleReplacement.js 89.28% <100.00%> (+1.32%) ⬆️

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 6efb133...e39f104. Read the comment docs.

// Used from tests
module.exports.clearCache = function() {
srcByModuleId = Object.create(null);
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should use mock for test it, no need it in runtime code

Copy link
Author

@Rulexec Rulexec Jul 7, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How to mock variable inside module?

Currently value inside srcByModuleId persists between tests and my situation happens only if it's clear.

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

3 participants