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

Main StoreGroup #141

Closed
azu opened this issue Mar 29, 2017 · 5 comments · Fixed by #174
Closed

Main StoreGroup #141

azu opened this issue Mar 29, 2017 · 5 comments · Fixed by #174

Comments

@azu
Copy link
Member

azu commented Mar 29, 2017

We have two StoreGroups.

StoreGroup feature depended on application architecture.
Two StoreGroup make user confuse.

Which is better?

We should include a signle StoreGroup.
Other StoreGroup should be separated as npm pacakge.

@azu
Copy link
Member Author

azu commented Apr 6, 2017

I've tried to write new StoreGroup.

azu/almin-cqrs-example#2

It is more strict version of QueuedStoreGroup.

  • It make StoreGroup#onChange is called when store is actually changed.
    • It means that it does diffiing prev state and next state.
  • It make Store and State read-model.
    • It means that the user can only write pull-design code on Store.
    • No this.onDispatch, No repository.onChange in Store
    • Make CQRS come true. (read stack)

Cons:

  • It make Store#getState signature change.
  • Call Store#getState many time

We should measure performance of that.

@azu azu mentioned this issue Apr 7, 2017
3 tasks
@azu
Copy link
Member Author

azu commented Apr 9, 2017

Store#getState<T>(prevState: T, payload): T;

I found a problem in this signature.
Logger like almin-logger can't get the state of store, because the Store#getState depended on prevState and payload.

Instead of that, a logger can get the state from StoreGroup or Context.
Because, call StoreGroup#getState() without arugments and return currect states.

Currently, StoreGroup and Store is inherited StoreLike interface.
Actually, StoreGroup#getState()'s signature difference from Store#getState(prevState: T, payload).
We make these difference thing.

@azu azu mentioned this issue Apr 16, 2017
8 tasks
@azu
Copy link
Member Author

azu commented Apr 17, 2017

Add new StoreGroup #154

@azu
Copy link
Member Author

azu commented Apr 22, 2017

We going to separate current StoreGroup and QueuedStoreGroup as a @almin/legacy-store-group module.

Why legacy?

We will define that new StoreGroup arguments is mapping object.
Current StoreGroup and QueuedStoreGroup accept an array of Stores.

Mapping Object?

new StoreGroup({
    "stateName": store
});

Pros

Cons

  • Can't define state name in the Store
    • == Define state name out of the Store
  • ?

@azu
Copy link
Member Author

azu commented Apr 22, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant