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

Self-mounting components don't call _mount from ProxyComponent #10

Closed
ekhaled opened this issue Mar 7, 2018 · 3 comments
Closed

Self-mounting components don't call _mount from ProxyComponent #10

ekhaled opened this issue Mar 7, 2018 · 3 comments

Comments

@ekhaled
Copy link
Owner

ekhaled commented Mar 7, 2018

Related to sveltejs/svelte-loader#43
and sveltejs/svelte#1201

when a top-level component calls this._mount() it's calling _mount from the internal instance.. and not from the proxyComponent.
Therefore it does not register itself in the Registry. Therefore, when navigating away and back in sapper, the Registry doesn't have a clue whether the component is mounted and doesn't _rerender the component

How to reproduce

On the sapper-template

  1. Go to /about
  2. Change something, see it get hot-loaded
  3. Go to home
  4. Go back to /about
  5. Now change something... it won't get hot-loaded
@ekhaled
Copy link
Owner Author

ekhaled commented Mar 7, 2018

Right, misdiagnosis of the root cause.

Although the _mount related stuff above is true, thats not what causes the hot reload to fail.

It fails because when new Component is called in sapper/runtime.js, that Component is not a proxyComponent. It's the original Svelte component.

Still trying to work out the cause, but it seems like somehow webpack returns the "un-heated" component without the proxy wrapper when a chunk is loaded lazily

@ekhaled
Copy link
Owner Author

ekhaled commented Mar 7, 2018

the load() here returns a naked svelte component undecorated by svelte-loader

@ekhaled
Copy link
Owner Author

ekhaled commented Mar 8, 2018

fixed here

@ekhaled ekhaled closed this as completed Mar 8, 2018
Rich-Harris added a commit to sveltejs/svelte-loader that referenced this issue Mar 14, 2018
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

No branches or pull requests

1 participant