-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Request for Comment: Attempt at removing react-palm for 1 task #1577
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Chris Chua <[email protected]>
Signed-off-by: Chris Chua <[email protected]>
Signed-off-by: Chris Chua <[email protected]>
Signed-off-by: Chris Chua <[email protected]>
Still a lot of ugly stuff. Signed-off-by: Chris Chua <[email protected]>
Signed-off-by: Chris Chua <[email protected]>
Signed-off-by: Chris Chua <[email protected]>
Signed-off-by: Chris Chua <[email protected]>
Signed-off-by: Chris Chua <[email protected]>
Signed-off-by: Chris Chua <[email protected]>
9fb6e70
to
2a6daaf
Compare
Signed-off-by: Chris Chua <[email protected]>
93f4fe1
to
1be7935
Compare
nice! I think though that we need to consider this alongside whether or not Kepler will migrate off of Redux. If that is a goal for Kepler, it might be good to keep the task system in the interim, but write hook-based APIs that allow you to resolve tasks local to a component rather than as part of redux dispatch. This would possibly give you the benefit of being able to keep the tests a bit closer to what they are right now. Then, once state is moved from Redux to local component state and/or React Context, you can start to remove tasks if that's desirable. |
I ran into the receiveMapConfig action and it's leading me to think along the same lines. My concern around this PR's current approach is that it moves the tasks code away from code that it should be local to (locality/proximity to where the request local action and map-style-updaters). Creating a component-based task resolver might alleviate that and also remove react-palm. It also preserves locality of the code and keeps side effects (their task effect definitions) into one area, that new component. Separately, IMO, removing redux seems like a larger effort/overhaul with fewer obvious benefits. But shall wait to hear what others think. |
I think moving off redux at the moment is a much larger undertaking, I would rather not involve it in this PR. We can still keep react-palm task system but separate it out from redux. This means we don't really need to remove react-palm A component-based task resolver is worth a try. One issue I see with component-based task resolver is that you always have to carefully handle responses resolved after the component is unmounted. Noting that we are also using react-palm to load files from the file uploader. we will have to move that logic into the file upload component. |
Approach
react-dom/test-utils
Here's what things could be like if we don't use react-palm for side effects/tasks.
Evaluation
Pros:
Cons:
resolves
before the method is called in order to have synchronous tests. It doesn't have the niceties of task draining/resolving in orderTASKS
exposed by therequest-map-styles
component.Overall: The tests seem a little less readable after removing tasks. However, I guess one could introduce some sinon.spy helpers to help with readability.
What this PR is missing / left todo:
doesNotThrow
callmapStyles
object but without infinite loop):kepler.gl/src/reducers/map-style-updaters.js
Lines 359 to 361 in 070b04b