Comments (16)
Any plans to support loadingKey for mutation?
from apollo.
I expected to at least have $apollo.loading
set to true, but that doesn't get updated. :(
So the current way to do this, is just use the ApolloMutation
component?
from apollo.
There is no loadingKey
feature on mutations at the moment. You can implement it very easily yourself:
this.loading ++
this.$apollo.mutate({
// Query
mutation: gql`mutation ($label: String!) {
addTag(label: $label) {
id
label
}
}`,
// Parameters
variables: {
label: newTag,
},
}).then((data) => {
this.loading --
}).catch((error) => {
this.loading --
});
from apollo.
Thank god, I left VueJS!
from apollo.
June 2021 and $apollo.loading
not work with mutation 😞
from apollo.
Maybe you can use the <ApolloMutation>
component?
from apollo.
I'm also having problems with loadingKey
from apollo.
+1
from apollo.
+1
from apollo.
+1
from apollo.
+1
from apollo.
Are there plans for this? We have a lot of cases where we do live updated forms, and want to have a "saving..." a la Google Docs. The amount of places we'd need to track variables for the mutation is doable but would be a lot easier if mutation just had a loadingKey instead of having to track variables in many different components.
I checked out the source code for adding this feature in a PR but at first look it seems more complex than I expected. mutate
just seems to be a wrapper for apollo-client
, and the query is tracked as part of smart-query
via an observable in watchQuery
and applyLoadingModifier
. I didn't go any further because it seems like I'd need to deep-dive into apollo-client
to follow it. Am I correct in this complexity or is it a simple matter of adding an observable to mutate
the way watchQuery
and subscribe
have?
from apollo.
That looks plausible. In one case, we have a form with 10 fields. If the user changes a field, we send a mutation to the server with the update, and at the top of the form show "saving". When the migration is done, we show "saved" for a few seconds. It looks like if we wrap the whole form with the ApolloMutation
component that it would work. I'll give it a shot, thanks!
from apollo.
ApolloMutation
works great! We've started using the component operations and it makes the code so nice and easy. Thank you for the PROTIP!
from apollo.
+1
from apollo.
+1
from apollo.
Related Issues (20)
- Not work with 3.2.25 HOT 2
- Make `provideApolloClient` default client disposable.
- Remove automatic subscription retry on error
- Can't receive messages in a chat using subscription
- skip() doesn't skip query HOT 1
- @vue/apollo-ssr doesn't work in SSR mode
- Fragments aren't returned in results when using useQuery/useLazyQuery reactive refs HOT 2
- Using vue-apollo-composable inside a Pinia setup store HOT 2
- `useApolloClient` checks wrong conditions before calling `inject()`
- useQuery blocks page load on 4.0.0 HOT 2
- useQuery with fetchPolicy: cache-only does not return expected data HOT 3
- Doesn't update the data after a mutation if `enabled` is `false` in `useQuery`
- Queries are not executed in given order
- @vue/[email protected] has a peer dependency conflict with Vue 3 HOT 4
- [docs] The installation guide is very bad HOT 1
- Refetch with New Variables Overrides Other Existing Refetches HOT 1
- `onBeforeUnmount` hook in `useQuery` is undesirable when used in pinia store HOT 1
- [Documentation] Composition API + Options API Configuration, how to make it work together? HOT 2
- Updating the `variables` ref does not work when using the function form
- Production breaks, dev mode works (Apollo client with id default not found.) HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from apollo.