Comments (2)
Nice catch. There are a few things at work here.
1 - The action deletes the hero in the data source. Then it passes the hero id to the mutation, which then tries to find that hero to delete it from the store (this fails to find one and moves along). Then the component re-loads the heroes in the store by querying the data source. This is why it "seems" to work and I missed this originally. The net result is the same, but it is misleading, and this is why you were confused on closer inspection of the code. Nice catch!
2 - The component does not need to reload the heroes. I added this code because despite the delete of the hero in the store (which wasnt happening, but should have been) ,there is a chance that another user modifies the database and this reload will get any changes. I added a comment to clarify this in the code as I do think it's a good practice. 9d1b333
3 - The fix I implemented is to pass the hero object from the action to the mutation. This is also in this commit 9d1b333
Thanks for the raising this!
from vue-getting-started.
I'm glad I wasn't crazy :) I, indeed, missed the reload in the method. It explains a lot.
Thank you !
from vue-getting-started.
Related Issues (14)
- Error with Sass HOT 5
- npm install fails HOT 2
- npm install fails every time now HOT 14
- Segment 7 - "Invalid Date" for Origin Date
- Begin script or PS video missing async during Watching Properties HOT 1
- Date mismatch in originDate, after using filter ahead one Day (+1)
- List and conditionals - v-if not working when selectedHero is undefined
- An error when get the heroes HOT 1
- Unable to load directly into hero/villain details after Vuex imp
- npm run serve failing HOT 5
- Cannot download "https://github.com/sass/node-sass/releases/download/v4.12.0/win32-x64-83_binding.node": HOT 2
- Vue latest library issue
- Proxy error HOT 1
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 vue-getting-started.