{"action":"created","issue":{"url":"https://api.github.com/repos/cyrilletuzi/angular-async-local-storage/issues/47","repository_url":"https://api.github.com/repos/cyrilletuzi/angular-async-local-storage","labels_url":"https://api.github.com/repos/cyrilletuzi/angular-async-local-storage/issues/47/labels{/name}","comments_url":"https://api.github.com/repos/cyrilletuzi/angular-async-local-storage/issues/47/comments","events_url":"https://api.github.com/repos/cyrilletuzi/angular-async-local-storage/issues/47/events","html_url":"https://github.com/cyrilletuzi/angular-async-local-storage/issues/47","id":363707106,"node_id":"MDU6SXNzdWUzNjM3MDcxMDY=","number":47,"title":"Update instead of Add? – re: Error: IndexedDB setter issue : Key already exists in the object store","user":{"login":"alignsoft","id":240491,"node_id":"MDQ6VXNlcjI0MDQ5MQ==","avatar_url":"https://avatars1.githubusercontent.com/u/240491?v=4","gravatar_id":"","url":"https://api.github.com/users/alignsoft","html_url":"https://github.com/alignsoft","followers_url":"https://api.github.com/users/alignsoft/followers","following_url":"https://api.github.com/users/alignsoft/following{/other_user}","gists_url":"https://api.github.com/users/alignsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/alignsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alignsoft/subscriptions","organizations_url":"https://api.github.com/users/alignsoft/orgs","repos_url":"https://api.github.com/users/alignsoft/repos","events_url":"https://api.github.com/users/alignsoft/events{/privacy}","received_events_url":"https://api.github.com/users/alignsoft/received_events","type":"User","site_admin":false},"labels":[{"id":472415293,"node_id":"MDU6TGFiZWw0NzI0MTUyOTM=","url":"https://api.github.com/repos/cyrilletuzi/angular-async-local-storage/labels/bug","name":"bug","color":"ee0701","default":true}],"state":"open","locked":false,"assignee":{"login":"cyrilletuzi","id":555867,"node_id":"MDQ6VXNlcjU1NTg2Nw==","avatar_url":"https://avatars2.githubusercontent.com/u/555867?v=4","gravatar_id":"","url":"https://api.github.com/users/cyrilletuzi","html_url":"https://github.com/cyrilletuzi","followers_url":"https://api.github.com/users/cyrilletuzi/followers","following_url":"https://api.github.com/users/cyrilletuzi/following{/other_user}","gists_url":"https://api.github.com/users/cyrilletuzi/gists{/gist_id}","starred_url":"https://api.github.com/users/cyrilletuzi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cyrilletuzi/subscriptions","organizations_url":"https://api.github.com/users/cyrilletuzi/orgs","repos_url":"https://api.github.com/users/cyrilletuzi/repos","events_url":"https://api.github.com/users/cyrilletuzi/events{/privacy}","received_events_url":"https://api.github.com/users/cyrilletuzi/received_events","type":"User","site_admin":false},"assignees":[{"login":"cyrilletuzi","id":555867,"node_id":"MDQ6VXNlcjU1NTg2Nw==","avatar_url":"https://avatars2.githubusercontent.com/u/555867?v=4","gravatar_id":"","url":"https://api.github.com/users/cyrilletuzi","html_url":"https://github.com/cyrilletuzi","followers_url":"https://api.github.com/users/cyrilletuzi/followers","following_url":"https://api.github.com/users/cyrilletuzi/following{/other_user}","gists_url":"https://api.github.com/users/cyrilletuzi/gists{/gist_id}","starred_url":"https://api.github.com/users/cyrilletuzi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cyrilletuzi/subscriptions","organizations_url":"https://api.github.com/users/cyrilletuzi/orgs","repos_url":"https://api.github.com/users/cyrilletuzi/repos","events_url":"https://api.github.com/users/cyrilletuzi/events{/privacy}","received_events_url":"https://api.github.com/users/cyrilletuzi/received_events","type":"User","site_admin":false}],"milestone":null,"comments":15,"created_at":"2018-09-25T18:19:11Z","updated_at":"2018-09-28T16:02:05Z","closed_at":null,"author_association":"NONE","body":"This is more of a question as to the correct approach to updates to data in the local store, not an issue or a bug, so my apologies if this isn't the correct venue.\r\n\r\nI'm running into this error (correctly, I might add):\r\n\r\n`error occured setting data in the local store Error: IndexedDB setter issue : Key already exists in the object store\r\n`\r\nThis occurs where I've set a key in the store, and then later am trying to reset a value for the same key, and it throws the above error. I can't anticipate when the user will navigate through a specific workflow that will cause a value to be fetched from over the network and re-added to the local store, so I'm trying to determine the best way to handle this.\r\n\r\nMy understanding is we can only add, not update(put) an object into the store, which brings me to the question of how to handle updates. Ideally I would like to update by default any existing value for a key already in the store, but failing that, is the accepted approach to always test for the presence of a key, and if it exists, to delete it first, then add the new value with that key?"},"comment":{"url":"https://api.github.com/repos/cyrilletuzi/angular-async-local-storage/issues/comments/425483658","html_url":"https://github.com/cyrilletuzi/angular-async-local-storage/issues/47#issuecomment-425483658","issue_url":"https://api.github.com/repos/cyrilletuzi/angular-async-local-storage/issues/47","id":425483658,"node_id":"MDEyOklzc3VlQ29tbWVudDQyNTQ4MzY1OA==","user":{"login":"alignsoft","id":240491,"node_id":"MDQ6VXNlcjI0MDQ5MQ==","avatar_url":"https://avatars1.githubusercontent.com/u/240491?v=4","gravatar_id":"","url":"https://api.github.com/users/alignsoft","html_url":"https://github.com/alignsoft","followers_url":"https://api.github.com/users/alignsoft/followers","following_url":"https://api.github.com/users/alignsoft/following{/other_user}","gists_url":"https://api.github.com/users/alignsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/alignsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alignsoft/subscriptions","organizations_url":"https://api.github.com/users/alignsoft/orgs","repos_url":"https://api.github.com/users/alignsoft/repos","events_url":"https://api.github.com/users/alignsoft/events{/privacy}","received_events_url":"https://api.github.com/users/alignsoft/received_events","type":"User","site_admin":false},"created_at":"2018-09-28T16:02:05Z","updated_at":"2018-09-28T16:02:05Z","author_association":"NONE","body":"So far, so good. I haven't had the 'Key already exists' error reoccur, and it appears the data I'm storing is what I'm expecting. My testing involves calling a set of services 530 times (each fetch is in a promise, which is pushed into an array of fetch promises and fired with `Promise.all([array-of-promises])`, and storing the resulting data each with it's own key. When it completes, I fire it again and overwrite the original data."}}
{"actor":{"display_login":"alignsoft"}}