Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

addItems mutation fix tempId #258

Merged
merged 2 commits into from
Sep 5, 2019

Conversation

fratzinger
Copy link
Collaborator

Currently I'm programming an progressive web app with feathers-vuex and localForage. I stumbled upon this. I wanted to restore keyedById from IndexedDB by using addItems. Instead of just overwriting the stores keyedById by the IndexedDB ones, I wanted to have them as Vuex-Models :)

This little change should fix the problem. Everything works for me now.

If tempId was assigned before calling addItems-mutation -> tempId is undefined -> newTempsById[undefined] = item

Again thanks for this great module! <3

If `tempId` was assigned before calling `addItems`-mutation -> `tempId` is undefined -> `newTempsById[undefined] = item`
if (!item[tempIdField]) {
var tempId = assignTempId(state, item)
let tempId = item[tempIdField];
if (!tempId) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change this to if(tempId == null) { so it will work with falsey, but valid, ids.

@marshallswain
Copy link
Member

Thanks for the great catch. I've made one comment. If you could update that tempId if statement, I'll gladly merge.

works with falsey tempId
@fratzinger
Copy link
Collaborator Author

Didn't think of that. Changed it. Thank you

@marshallswain marshallswain merged commit 68c093f into feathersjs-ecosystem:typescript Sep 5, 2019
@marshallswain
Copy link
Member

Published as feathers-vuex@2.0.0-pre.76

@fratzinger fratzinger deleted the patch-2 branch August 23, 2022 12:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants