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

Cycle events #35

Closed
samuelsimoes opened this issue May 21, 2016 · 4 comments
Closed

Cycle events #35

samuelsimoes opened this issue May 21, 2016 · 4 comments

Comments

@samuelsimoes
Copy link
Collaborator

samuelsimoes commented May 21, 2016

Today our React connector (https://github.com/fluxo-js/fluxo-react-connect) is smart enough to collect all events on the tick and only call once the React.Component#setState on the next tick, avoiding a massive amount of setState calls, but sadly the connector might lose this feature because this issue fluxo-js/fluxo-react-connect-stores#4

So I'm thinking that Fluxo needs trigger events around the methods that cause state mutations like #set, #setAttribute and so on. This will give the chance to a lib like the connector only trigger an interface rerender when all the state dependencies were computed. This will specially valid to methods like setStores, addStores and so on where these methods may trigger a lot of add, remove and other events.

The name of these events coud be like cycle:setAttribute:start, cycle:setAttribute:end and so on.

@sobrinho
Copy link
Member

That's not the idea of change event?

@samuelsimoes
Copy link
Collaborator Author

Yes, you're right, yesterday I was thinking about this and today our internal events are a bit disorganized and the change events can be triggered many times on some methods, example: setAttribute that changes some attribute that triggers a computed property update triggers two changes. On other cases, like setStores that can update many stores once many changes may be triggered.

I'm working on an adjustment to organize the events, on this patch Fluxo will only trigger the change event once per method that does some state mutation. I'll submit this patch soon with more information about.

@sobrinho
Copy link
Member

Can be closed now, right?

@samuelsimoes
Copy link
Collaborator Author

samuelsimoes commented May 25, 2016

Yes, I forgot. Closed by #36

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

No branches or pull requests

2 participants