Skip to content
This repository has been archived by the owner on Feb 16, 2023. It is now read-only.

Why the two-level structure for the changes? #49

Open
domenic opened this issue Jun 20, 2017 · 3 comments
Open

Why the two-level structure for the changes? #49

domenic opened this issue Jun 20, 2017 · 3 comments

Comments

@domenic
Copy link

domenic commented Jun 20, 2017

I.e., why does the callback get called with an IDBObserverChanges which contains a map of IDBObserverChangeRecords?

Why not instead call the callback once for each change record (and add db/transaction/object store name fields to the change record)?

@dmurph
Copy link
Collaborator

dmurph commented Jun 21, 2017

That would make ensuring data consistency hard - we want to keep the callback-per-transaction behavior as this makes a ton of sense for developers, and it allows us to provide the readonly transaction for the rest of the world.

If we did this, then we couldn't provide the optional transaction for reading the rest of the world (or just reading the values of the keys that changed).

We could flatten them and provide the object store name per record - then we can preserve order as well. But we'll have a lot of data duplication w/ the object store name.

@domenic
Copy link
Author

domenic commented Jun 21, 2017

Yes, I was thinking adding the object store name as well, as in my OP. How bad would the duplication be?

To be clear, although I think simpler is better, there are probably valid reasons for the current design. I just want to help get the explainer to cover this question, as I think it'd be a FAQ.

@dmurph
Copy link
Collaborator

dmurph commented Jul 31, 2017

I'll make this a FAQ entry and invite others to voice preference.

dmurph added a commit that referenced this issue Jul 31, 2017
* renamed 'culling' to 'coalescing' - #45
* added FAQ entry for flattening list - #49
* left link about feature detection - #44
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants