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 getEventSourceWrapper window on iframe #358

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

fix getEventSourceWrapper window on iframe #358

wants to merge 1 commit into from

Conversation

minimit
Copy link

@minimit minimit commented May 8, 2019

This PR contains a:

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

Motivation / Use-Case

When using iframes HMR was initializing inside each iframe, this way intead we use the parent instance of window.__whmEventSourceWrapper so you have no duplicate listeners and no limit on how many iframes you can have before the HMR hungs up with too many calls.

Breaking Changes

None

Additional Info

@codecov
Copy link

codecov bot commented May 8, 2019

Codecov Report

Merging #358 (9305296) into master (fe33d59) will decrease coverage by 0.24%.
The diff coverage is 87.50%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #358      +/-   ##
==========================================
- Coverage   88.63%   88.38%   -0.25%     
==========================================
  Files           3        3              
  Lines         264      267       +3     
  Branches       76       77       +1     
==========================================
+ Hits          234      236       +2     
- Misses         30       31       +1     
Impacted Files Coverage Δ
client.js 83.92% <87.50%> (-0.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 fe33d59...9305296. Read the comment docs.

@minimit
Copy link
Author

minimit commented Jun 10, 2019

I've tested with iframes and it works good, you can have as many iframes that you want and the hot reloads styles inside and outside the iframes!

@minimit
Copy link
Author

minimit commented Sep 8, 2019

Closing for revision in firefox

@minimit minimit closed this Sep 8, 2019
@minimit minimit reopened this Nov 25, 2019
// cache the wrapper for other entries loaded on
// the same page with the same options.path
window.__whmEventSourceWrapper[options.path] = EventSourceWrapper();
top.__whmEventSourceWrapper[options.path] = EventSourceWrapper();

Choose a reason for hiding this comment

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

I think we should not keep it cached now. e.g. On this reload server is closing web socket connection
module.hot.accept() => { window.location.reload(); });
while when creating new EventSourceWrapper(); it work properly.

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.

2 participants