Skip to content
This repository has been archived by the owner on Jul 30, 2018. It is now read-only.

Materialize #73

Merged
merged 2 commits into from
Dec 16, 2016
Merged

Materialize #73

merged 2 commits into from
Dec 16, 2016

Conversation

maier49
Copy link
Contributor

@maier49 maier49 commented Dec 9, 2016

Type: feature

Description:

Provides a simple API for materializing QueryTransformResults. This builds on the work in #67 so that will need to be merged first. Without an apply function materialize will add() all adds, put() all updates, and delete() all deletes received in the StoreDeltas from the observed QueryTransformResult. It will also add all data in the afterAll property of the initial update.

It returns a Handle that can be destroyed to prevent further updates.

Specifying an apply function allows the application of updates to be customized.

A lot of the concerns brought up in the original issue would be handled by the developer in the provided apply function.

Conflict resolution is one of the targeted uses of the StoreObservable interface, so when that is implemented, using a target store that supports it would potentially be part of the solution there.

Related Issue: #21

Please review this checklist before submitting your PR:

  • There is a related issue
  • All contributors have signed a CLA
  • All code matches the style guide
  • The code passes the CI tests
  • Unit or Functional tests are included in the PR
  • The PR increases or maintains the overall unit test coverage percentage
  • The code is ready to be merged

@codecov-io
Copy link

codecov-io commented Dec 9, 2016

Current coverage is 100% (diff: 100%)

Merging #73 into master will not change coverage

@@           master    #73   diff @@
====================================
  Files          15     16     +1   
  Lines        1096   1114    +18   
  Methods         6      6          
  Messages        0      0          
  Branches      185    191     +6   
====================================
+ Hits         1096   1114    +18   
  Misses          0      0          
  Partials        0      0          

Powered by Codecov. Last update 6f86aa5...ae6d4cb

if (update.afterAll.length) {
target.add(update.afterAll);
}
} else {
Copy link
Member

Choose a reason for hiding this comment

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

else should be on new line.

if (updates.length) {
target.put(updates);
}

Copy link
Member

Choose a reason for hiding this comment

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

random line break

trackableQueryStore.add(createData());
trackableQueryStore.put(createUpdates()[0]);

setTimeout(dfd.callback(() => {
Copy link
Member

Choose a reason for hiding this comment

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

we can use dojo-core/timing#delay for these scenarios and return the promise instead of using the dfd.callback

import * as registerSuite from 'intern!object';
import * as assert from 'intern/chai!assert';
import * as sinon from 'sinon';
import {createData, ItemType, createUpdates} from '../support/createData';
Copy link
Member

Choose a reason for hiding this comment

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

missing white space.

Copy link
Member

@agubler agubler left a comment

Choose a reason for hiding this comment

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

again just a really minor formatting nit pick that can be fix later.

@agubler agubler merged commit c2e4eef into dojo:master Dec 16, 2016
dylans added a commit to dylans/stores that referenced this pull request Dec 16, 2016
agubler pushed a commit that referenced this pull request Dec 16, 2016
@maier49 maier49 deleted the materialize branch March 10, 2017 18:47
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants