devabhishekpal commented on PR #7171:
URL: https://github.com/apache/ozone/pull/7171#issuecomment-2341729481

   So the main reason this hasn't been broken down is because the state needs 
to be shared, and state can only go one way.
   Even though we can have workarounds to share the state from child to 
parents, this is against the React code practices.
   If we add something like Redux to share state, we can break this logic down 
to individual components.
   
   For the dividing of data I think this is a good idea to have hook for each 
component.
   However we need to rethink the logic for **autoReload**
   AutoReload accepts a function/loader which it will call in intervals.
   Currently this function is the function that we use to fetch data 
`loadData()` in this case.
   
   But hooks can only be called in the component level and cannot be wrapped 
inside functions.
   Hence we cannot do:
   ```
   new AutoReloadHelper(usePipelinesData());
   ```
   
   I'll think of a better implementation for AutoReloadHelper.
   
   These two points are the major reason the current code is complex and is not 
broken up into components.
   I had a few cleanup points as well which I wanted to tackle in the next 
phase by adding a state store like Redux to allow more pluggable components 
rather than having all logic in same place.
   
   For the time being since we cannot avoid this, could you help take another 
look and let me know your inputs for other things?
   Thanks


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to