ef4 / prember

Prerender Ember apps with Fastboot at build time.
MIT License
195 stars 17 forks source link

Always loads index then transitions w/ service workers #11

Closed RobbieTheWagner closed 6 years ago

RobbieTheWagner commented 6 years ago

It seems that whenever I try to go directly to a route or I refresh the page, the index page is loaded, and then the route I tried to go to is loaded. How can I avoid the double load and just load the one page I want to actually go to?

RobbieTheWagner commented 6 years ago

Actually, it seems this is due to service workers. Is there something special I need to do to configure sw with prember?

ef4 commented 6 years ago

Service workers can be used in lots of ways, so it's hard to say without more detail. But if your SW is assuming it should serve every route with a cached copy of index.html (a not unreasonable thing to do in a standard ember app) that could cause something like what you're describing.

RobbieTheWagner commented 6 years ago

@ef4 yeah, it was from ember-service-worker-index, which does assume that. It seems that we need a new SW addon to support prember. I would love to help implement, but I don't know much about SW. I tried broccoli-serviceworker, but it didn't seem to work either. I tried setting it to cache first for all my routes index.html, but not sure if that is correct?

RobbieTheWagner commented 6 years ago

@ef4 I'm working on an addon to make this easy for everyone. It at least somewhat works for my website. I would definitely love to have more people test it out and help out with it though 😄 . https://github.com/shipshapecode/ember-service-worker-prember

RobbieTheWagner commented 6 years ago

This is no longer an issue, but could still use help with my addon!