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

Core-data: do not publish outdated state to subscribers during updates #19752

Merged
merged 4 commits into from
Jan 21, 2020
Merged

Core-data: do not publish outdated state to subscribers during updates #19752

merged 4 commits into from
Jan 21, 2020

Commits on Jan 19, 2020

  1. Core-data: do not publish outdated state to subscribers during updates

    Calling `saveEntityRecord` with an update does the following:
    
    1. Calls `getEntityRecord` to fetch the current persisted state of the entity record
    2. Calls `receiveEntityRecords` with the new up-to-date state to render the updates
    3. Sends an API fetch with the update patch to persist the update
    4. Calls `receiveEntityRecords` again with the new up-to-date *persisted*
    state
    
    The issue here, is that point 1 (Calling `getEntityRecord`) not only fetches
    the persisted state, but it also internally calls `receiveEntityRecords` itself .
    This results in the persisted outdated server state to be rendered
    on the UI, causing a flickering effect, that jumps pack when point 2
    takes turn.
    
    This commit removes the call to getEntityRecord, and instead, it just
    calls receiveEntityRecords with the local up-to-date state of the entity
    record. This fixes the flickering issue.
    alshakero committed Jan 19, 2020
    Configuration menu
    Copy the full SHA
    90f5adc View commit details
    Browse the repository at this point in the history
  2. Core-data: update tests to match saveEntityRecord yeilded actions

    Given `saveEntityRecord` no longer selects `getEntityRecord`,
    which itself triggers a SELECT action, two SELECTs are no longer
    yielded. This commit removes the expectation of these two SELECTs.
    alshakero committed Jan 19, 2020
    Configuration menu
    Copy the full SHA
    581c16c View commit details
    Browse the repository at this point in the history

Commits on Jan 20, 2020

  1. Core-data: Introduce getEntityRecordNoResolver selector

    To allow saveEntityRecord access the latest local full version
    of an entity without issung an API request. This prevents
    propogating outdating states to subscribers when
    saveEntityRecord is called.
    
    See: #19752 (comment)
    alshakero committed Jan 20, 2020
    Configuration menu
    Copy the full SHA
    a267c35 View commit details
    Browse the repository at this point in the history
  2. Address review comments at #19752:

    1. Capitalize alll added comment messages
    2. Alias getEntityRecord with getEntityRecordNoResolver instead of copying it
    3. Use describe.each instaed of looping manually in selectors tests
    alshakero committed Jan 20, 2020
    Configuration menu
    Copy the full SHA
    ad785c8 View commit details
    Browse the repository at this point in the history