Skip to content
This repository has been archived by the owner on May 13, 2019. It is now read-only.

Consider Reflux replacement #28

Closed
ivan-kleshnin opened this issue Mar 14, 2015 · 10 comments
Closed

Consider Reflux replacement #28

ivan-kleshnin opened this issue Mar 14, 2015 · 10 comments
Labels

Comments

@ivan-kleshnin
Copy link
Member

I'm getting tired of Reflux. They seems to be really lost in what they do. Actions are flawed.

Candidates to watch and replace:
Flummox
Minimal Flux
Rx-Flux
ThunderCats (remix of the prev one)

Both are better then Reflux. I like API of the second one more, but it doesn't support async actions at this moment. It's better to wait a bit and see what will happen next.

@ivan-kleshnin
Copy link
Member Author

Another option is to completely ditch React and move to CycleJS (project will be renamed to JS starter :) )
Benefits: CycleJS > ReactJS (it's much more intelligent library).
Drawbacks: lack of docs, examples and my own understanding of Rx concepts.
Again, will wait and see how the things go.

@ivan-kleshnin
Copy link
Member Author

Relevant links:

acdlite/flummox#63
malte-wessel/minimal-flux#1
reflux/refluxjs#197

Reflux doesn't normally support isomorphic JS (fail). They propose some ugly hacks but I don't care.
Flux is a messy concept on itself so the more I think about it, the more I like the idea to get rid of it.

@ivan-kleshnin
Copy link
Member Author

Another interesting one is Baobab. Quote:

Baobab is a JavaScript data tree supporting cursors and enabling developers to easily navigate and monitor nested data. It is mainly inspired by functional zippers such as Clojure's ones and by Om's cursors. It can be paired with React easily through mixins to provide a centralized model holding your application's state.

Related article

@ivan-kleshnin
Copy link
Member Author

Transition to Baobab in progress.

Please help to deal with forms:
Yomguithereal/baobab#145

@ivan-kleshnin
Copy link
Member Author

Beta version of Baobab branch is released.
State questions are solved to some degree. Please read source.

@scabbiaza
Copy link
Member

Thank you for sharing this! Looks very, very good!

This action looks very nice:
https://github.com/Paqmind/react-starter/blob/baobab/frontend/app/robot/actions/add.js

And it's a pain, isn't?
https://github.com/Paqmind/react-starter/blob/baobab/frontend/app/robot/components/add.js

I have some questions:

  1. https://github.com/Paqmind/react-starter/blob/baobab/frontend/app/robot/models.js#L5
    Don't understand why to call here Alert? in robot/models?
  2. Don't understand, who will catch that:
    https://github.com/Paqmind/react-starter/blob/baobab/frontend/app/robot/actions/loadmany.js#L22
  3. https://github.com/Paqmind/react-starter/blob/baobab/frontend/app/robot/actions/loadmany.js#L26
    loadError will be undefined here, no?
    so this will not work:
    https://github.com/Paqmind/react-starter/blob/baobab/frontend/app/robot/components/index.js#L25
  4. What is the case for loadOne? When it can be called?
  5. In case of failed removing on backend:
    https://github.com/Paqmind/react-starter/blob/baobab/frontend/app/robot/actions/remove.js#L25
    So we will see alert + if we are on list page item will be added to this list, right? nice!
    Can we add link on detail page on this alert for better usability:
    addAlert({message: "ActionRobot.removefailed", category: "error"});

@ivan-kleshnin
Copy link
Member Author

And it's a pain, isn't?

Not so much. All complexity is exposed there now and can easily be refactored later.
I just don't want to hurry with this.

_1. Don't understand why to call here Alert? in robot/models?

It's not a call. It's a declaration.
Alert should be renamed to Robot of course. Just copy-paste artefact.

_2. Don't understand, who will catch that:

Environment. Browser or Node.js. We need to rethrow all errors besides HTTP. Otherwise they will be swallowed and fail silently.

_4. What is the case for loadOne? When it can be called?

It's meant to be called from detail / edit pages to load exactly one model by id.

_3. loadError will be undefined here, no?

Error. Need to fix.

@ivan-kleshnin
Copy link
Member Author

_5. In case of failed removing on backend... So we will see alert + if we are on list page item will be added to this list, right? nice!

I don't get how removal can cause item addition. Please rephrase this whole question.

@scabbiaza
Copy link
Member

Thank you!

About removing
In this row old model will be added to the list of models, right?
https://github.com/Paqmind/react-starter/blob/baobab/frontend/app/robot/actions/remove.js#L32

Component, that use this data, will be updated.
So in case if user is on list page, he/she will see that this deleted element will appear on the page.

Is it correct?

@ivan-kleshnin
Copy link
Member Author

In this row old model will be added to the list of models, right?
https://github.com/Paqmind/react-starter/blob/baobab/frontend/app/robot/actions/remove.js#L32
Component, that use this data, will be updated.
So in case if user is on list page, he/she will see that this deleted element will appear on the page.
Is it correct?

Yes

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

No branches or pull requests

2 participants