sysgears / apollo-universal-starter-kit

Apollo Universal Starter Kit is a SEO-friendly, fully-configured, modular starter application that helps developers to streamline web, server, and mobile development with cutting-edge technologies and ultimate code reuse.
https://apollokit.org
MIT License
1.68k stars 323 forks source link

Question: Frontend reloads on front end change #759

Closed wojcikiewiczm closed 6 years ago

wojcikiewiczm commented 6 years ago

Hello, I want to ask. When I'm editing for example component then frontend reloads on save instead of hot reloading. It's not reloading every time it's, I don't know lets say every third save or something like that. So I'm not sure if it's feature or bug. Of course I have made some changes in devstack but I'm not aware of changing something connected to hot reload. So I would like to know if I messed up something or it's really feature. Thanks

larixer commented 6 years ago

@wojcikiewiczm Hi. We are using hot reload phrase in the meaning webpack hot module replacement. I'm not sure what your question is?

wojcikiewiczm commented 6 years ago

@vlasenko Well I mean that when I save for example some change in component whole website browser window reloads (like window.reload()). I managed to figure it out and it's weird. I dont use containers as you're in example. My cointaners returing divs and components not only one return with component as you're. So when my container is complex then when i save any change in code, window browser reloads like I've made some changes to backend but I didn't.

larixer commented 6 years ago

@wojcikiewiczm The issues here is to report the issue about the kit. If you want to report an issue please provide exact reproduction steps or provide a fork of the kit that reproduces issue that you have.

larixer commented 6 years ago

@wojcikiewiczm What is the output in your web browser javascript console before save and right after save - attach two screenshots please.

wojcikiewiczm commented 6 years ago

@vlasenko I managed to fix this problem. Problem was that i had as Feature file index.js (because I'm using only web). So when I had index.js HMR reloaded browser window. When i renamed index.js to index.web.js hot reload works as should. I think it's a bug or? For only web usage it should be fine to use only index.js without ".web" word.

larixer commented 6 years ago

@wojcikiewiczm Could you prepare fork with reproduction? It is hard to say something without seeing the code.

larixer commented 6 years ago

@wojcikiewiczm It should be fine to use index.js without .web extension

larixer commented 6 years ago

I'm closing this for now. As I said we need reproduction to move forward the investigation.

wojcikiewiczm commented 6 years ago

@vlasenko sorry for delay. Here is screenshot of console https://imgur.com/a/IqUbPEX. I will try to make a fork with reproduction as soon as possible. I placed red arrow on image to define section before reload and after reload. It's just behaving as normal hot reload but in then end it just reloads browser window. I'm using windows 10, node v8.9.4, yarn v1.7.0. Packages versions are same as in stable branch of starter kit.

larixer commented 6 years ago

@wojcikiewiczm Are there any messages on server-side before and after reload? Looks like full client-side reload is triggered by the server webpack process, because it thinks you changed server-side code

wojcikiewiczm commented 6 years ago

@vlasenko yeah I'm getting this. But I'm not changing this file. That's weird...

[at-loader] Ok, 0.052 sec.
server-webpack debug Force front-end current page refresh, due to change in backend at: C:\Users\Martin\Desktop\WCM\packages\server\src\index.ts
server-webpack info Time: 589ms
web-webpack debug bundle is now VALID.
web-webpack info Time: 878ms
web-webpack debug bundle is now VALID.
web-webpack info Time: 820ms
larixer commented 6 years ago

@wojcikiewiczm Well, you can just disable this front-end forced refresh on backend change. There is an option to disable it: https://github.com/sysgears/apollo-universal-starter-kit/blob/master/packages/server/.spinrc.js#L28

Other then that, looks like your src\index.ts somehow depends on some frontend file in your code base and spinjs thinks you have changed backend and tries to help you by triggering frontend page refresh