quasarframework / app-extension-apollo

The official Quasar App-Extension for Apollo and GraphQL - Currently Beta!
https://quasar.dev
109 stars 19 forks source link

Infinite loading on SSR #115

Closed keanugrieves closed 1 year ago

keanugrieves commented 2 years ago

I finally made the switch to Quasar 2, and in SSR mode, I'm stuck in an infinite loop whenever I add similar queries to components that are loading simultaneously, e.g.

MainLayout.vue

query MainLayoutCurrentUser {
  currentUser {
    id
    role
  }
}

MainHeader.vue

query MainHeaderCurrentUser {
  currentUser {
    id
  }
}

It's blazing fast when I load just one of those queries, or if I disable SSR entirely, but otherwise, it's stuck forever.

Other fixes I've tried:

I'm really at a loss here as to how to fix it. The only similar issue was a Vue 2 problem that was supposedly fixed in https://github.com/vuejs/vue-apollo/pull/1241

Any ideas?

smolinari commented 2 years ago

@keanugrieves - sorry for the late reply. I'm totally new to SSR. Could you possibly make a minimum reproduction of the issue? I'll see if I can get other eyes onto it too, once you do.

Scott

keanugrieves commented 2 years ago

@smolinari You can find the minimum reproduction here, although while building this, I noticed that it only breaks while using the newly created Apollo client in router guards.

You can switch boot files from apollo-broken to apollo-healthy to see the difference, but SSR works with two identical queries in components as long as the same query isn't present in a boot file.

It might seem silly in this reproduction, but I use the router guards in my production app to ensure that the user has the correct role to access a given route, as I'm creating an admin dashboard.

Thanks for getting back to me!

smolinari commented 2 years ago

A side note/ question, but if the app is for an admin dashboard, SSR isn't really necessary, is it?

Scott

keanugrieves commented 2 years ago

I'm also working on three child sites all feeding off of that admin dashboard, which incorporate auth tokens and need SSR (for Facebook sharing meta tags), so I was hoping to get comfortable with it before I do those.

This project is unimaginably large for someone with my experience and skill set, so if you have a minute, are feeling generous and have any large-scale suggestions for reimagining this whole project, I'd love to chat on Discord.

Side question: will m8a be SSR-capable?

smolinari commented 1 year ago

@keanugrieves - Sorry this got dropped. Did you get further? I'm closing for now, but if you need anything you can reopen or create a new issue.

Scott