[Documentation] How to access fragments on lazy-loaded components #859
Replies: 6 comments
-
You can put the fragments in a sibling JS file instead. |
Beta Was this translation helpful? Give feedback.
-
There are no options that allow colocating fragments with lazy-loaded components? |
Beta Was this translation helpful? Give feedback.
-
You can't use code from an async chunk without loading it first. That's not technically possible, the browser can't guess what your code is without loading it. |
Beta Was this translation helpful? Give feedback.
-
That is known. However, the view isn't being rendered until after that async chunk is loaded, so I would expect the |
Beta Was this translation helpful? Give feedback.
-
The component you have the query in is not lazy loaded. Thus the query is executed. |
Beta Was this translation helpful? Give feedback.
-
I think the core here is that we should have a recommendation/plan on a best practice for being able to allow components to define their data needs so that a parent can compose them. IMO, that should be in a file next to the component or in a global graphql folder. I know that is not perfect but it is easy and works with existing infra. The issue with placing them in the child and working in above way would require
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Some patterns recommended by
vue-apollo
break patterns we commonly use when writing Vue apps. Here's an example.vue-apollo
suggests storing fragments in the default export object of a component, and then accessing them from the imported component. However, we lazy-load all of our components as shown above, which seems to make it impossible to reference the fragments property.It appears that a core tenant of how to deal with co-located fragments in
vue-apollo
doesn't work with modern vue patternsBeta Was this translation helpful? Give feedback.
All reactions