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

Convert to 2.2 class mixins - patches, queries, and storage #109

Merged
merged 11 commits into from
Feb 9, 2017

Conversation

maier49
Copy link
Contributor

@maier49 maier49 commented Feb 8, 2017

Type: feature

Description:
Converts part of the stores repo to use TypeScript classes instead of dojo/compose. Doesn't replace any mixins so 2.2 class mixins are not used.

Relates to: #108
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 Report

Merging #109 into master will not impact coverage.

@@          Coverage Diff          @@
##           master   #109   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          17     17           
  Lines        1396   1393    -3     
  Branches      255    253    -2     
=====================================
- Hits         1396   1393    -3
Impacted Files Coverage Δ
src/store/mixins/createQueryTransformMixin.ts 100% <ø> (ø)
src/store/mixins/createTransactionMixin.ts 100% <ø> (ø)
src/store/createStore.ts 100% <100%> (ø)
src/patch/Patch.ts 100% <100%> (ø)
src/query/createFilter.ts 100% <100%> (ø)
src/patch/createOperation.ts 100% <100%> (ø)
src/storage/InMemoryStorage.ts 100% <100%> (ø)
src/store/createQueryTransformResult.ts 100% <100%> (ø)
src/query/createSort.ts 100% <100%> (ø)
src/patch/JsonPointer.ts 100% <100%> (ø)
... and 5 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 78a22a0...7e5f4d4. Read the comment docs.

Copy link
Member

@dylans dylans left a comment

Choose a reason for hiding this comment

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

Not the most thorough review, but it looks solid. There are a few things I don't quite understand yet (e.g. why we still have things like createSort and createFilter), but I assume there's a reason that I'm not following yet, so I think it has my approval. You may want to wait for someone else to approve as well.

@@ -56,7 +56,8 @@ export const loaderOptions = {
{ name: 'dojo', location: 'node_modules/intern/browser_modules/dojo' },
{ name: '@dojo', location: 'node_modules/@dojo' },
{ name: 'sinon', location: 'node_modules/sinon/pkg', main: 'sinon' },
{ name: 'rxjs', location: 'node_modules/@reactivex/rxjs/dist/amd', main: 'Rx.js' }
{ name: 'rxjs', location: 'node_modules/@reactivex/rxjs/dist/amd', main: 'Rx.js' },
Copy link
Member

Choose a reason for hiding this comment

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

Do we still need rxjs here? Probably not related to this PR, but might as well clean it up since this PR is cleaning up many things...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No we don't need it. Good catch I'll clean that up.

@@ -21,7 +19,15 @@ function delayOperation(operation: Function, operationName: string) {
};
}

const createAsyncStorage = createInMemoryStorage.mixin({
const createAsyncStorage = compose(InMemoryStorage).mixin({
Copy link
Member

Choose a reason for hiding this comment

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

interesting that this now needs compose?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a temporary hack as I haven't updated this test implementation(on this branch). It's just wrapping the class in a call to compose to make it a factory so it can be extended.

@dylans dylans added this to the 2017.02 milestone Feb 8, 2017
@maier49
Copy link
Contributor Author

maier49 commented Feb 8, 2017

@dylans To your general comment about createSort, createFilter, etc., that's probably part of a larger discussion about what moving back to TypeScript classes will mean for some of our patterns. Those are just factory functions and aren't actually leveraging compose. I can implement them as classes if we now want to avoid factories all together and strongly prefer classes. I don't have a strong feeling about it either way.

@agubler Any thoughts on the above?

@agubler
Copy link
Member

agubler commented Feb 9, 2017

I think you're right regarding the need for a broader discussion about the general patterns used across Dojo 2 post moving to Classes from compose. As for simple factory functions, I actually don't mind them as a pattern - sometimes using classes is probably unnecessary (this is kind of proved by the fact that they were not compose factories anyway).

We have functions in widget-core like w and v the operate in a similar fashion.

@maier49 maier49 merged commit 0d3dfe4 into dojo:master Feb 9, 2017
@maier49 maier49 deleted the typescript-2.2-mixins branch March 10, 2017 18:43
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