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

fix: support calling save multiple times #249

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Commits on Nov 11, 2019

  1. Configuration menu
    Copy the full SHA
    9bfde5c View commit details
    Browse the repository at this point in the history

Commits on Jan 7, 2020

  1. fix: support multiple createRecord calls (fixes pouchdb-community#239)

    This commit changes how ember-pouch implements `Adapter.createRecord`,
    which is invoked after calling `.save()` on a new record,
    so that it does not create multiple records if `.save()` is called
    more than once before the first operation has finished.
    
    If `.save()` is only invoked once before the record has finished persisting
    to the DB (i.e. the promise that it returns has resolved) then
    the behavior is unchanged. However, subsequent calls will wait for
    the previously returned promise to resolve and then, if changes have
    been made to the record, as indicated by Snapshot#changedAttributes,
    it will delegate the task to `updateRecord`.
    
    To avoid a problem caused by ember-data changing the ID associated
    with the internalModel/record when the record has finished persisting,
    the `Adapter.generateIdForRecord` method has been implemented so
    that the ID is available immediately. Previously ember-pouch had still
    been generating this id during `createRecord`, but ember-data was
    not being made aware of this until its returned promise resolved.
    
    Also, rather than rely on `adapter.db.rel.uuid()` to generate
    an RFC4122 v4 UUID (requiring initialization to have completed),
    this has been replaced by the equivalent `uuid` module from npm,
    and the ember-auto-import addon has been installed to make it
    easy to access this from within ember-pouch.
    
    Finally, the `engines` section of package.json has been updated
    to align with ember-auto-import's minimum version of 6.x
    BREAKING CHANGE: drop node 4.x support (and 6.x/7.x not tested by CI)
    jacobq committed Jan 7, 2020
    Configuration menu
    Copy the full SHA
    7c238ff View commit details
    Browse the repository at this point in the history