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

Loading infinite when no sub categories exist. #3

Open
prathamVaidya opened this issue Feb 21, 2024 · 0 comments
Open

Loading infinite when no sub categories exist. #3

prathamVaidya opened this issue Feb 21, 2024 · 0 comments

Comments

@prathamVaidya
Copy link

prathamVaidya commented Feb 21, 2024

Issue

Issue is depended on PR #2

When a category has 0 sub categories that loading does not stop even after server's response.

image

This logic is not enough to decide Loading Component should be rendered or not.
Fails when isExpanded is true and category has 0 sub categories.

return isExpanded && element.children.length === 0 ? (

Possible Solutions

  1. Creating a loading list state that contains categories id of category that are loading.
  2. Using redux or useReducer for creating action based state for main tree data structure and adding loading state in every category node.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant