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

Add autoDisposeIndexes to dispose unused IndexedStack children and rebuild them when needed #7

Merged
merged 4 commits into from
Jan 28, 2025

Conversation

colonal
Copy link
Contributor

@colonal colonal commented Jan 17, 2025

  • Added a new property, forceReloadIndexes, to enable forced reloading of specific child widgets each time they are displayed.

  • Introduced a _updateChildrenForReload method to manage widget updates, ensuring proper cleanup and handling for child elements.

  • Enhanced LazyIndexedStack functionality to provide fine-grained control over widget rendering and lifecycle management.

These updates make the LazyIndexedStack more flexible and suitable for complex widget management scenarios, such as resource-intensive or frequently updated UI elements.

Copy link
Owner

@okaryo okaryo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@colonal
Thank you for creating this Pull Request. The changes look good overall. I'm good to merge it, but before that, I'd like to understand the specific use cases or scenarios where this feature is needed. Could you please share more details if possible?

@colonal colonal force-pushed the force_reload_indexes branch from 9159e12 to 06a8e83 Compare January 27, 2025 20:18
@colonal
Copy link
Contributor Author

colonal commented Jan 27, 2025

@colonal Thank you for creating this Pull Request. The changes look good overall. I'm good to merge it, but before that, I'd like to understand the specific use cases or scenarios where this feature is needed. Could you please share more details if possible?

@okaryo
Thank you for reviewing the PR and your feedback!

The forceReloadIndexes feature is primarily needed for scenarios where specific indexed stack pages require a forced reload without impacting others. For instance:

  • Dynamic Data Loading: When a particular tab in the stack depends on real-time or frequently changing data, this feature ensures the associated widget reloads properly.
  • State Reset: Certain tabs might hold stateful widgets, and reloading them can reset their state for a fresh user experience without affecting other tabs.

The _updateChildrenForReload method complements this by facilitating granular child updates, ensuring efficient and targeted rebuilds.

Please note that I also updated the README.md file to reflect these changes and provide usage examples.

Feel free to let me know if you need further clarification or additional examples! 😊

@okaryo okaryo added the feature New feature or request label Jan 28, 2025
@okaryo
Copy link
Owner

okaryo commented Jan 28, 2025

@colonal
Thank you for the updates and the README changes!

After considering the use cases you provided, it seems that the main purpose of this feature is to dispose of widgets for specific indexes when they are not in use. With that in mind, how about renaming the property to autoDisposeIndexes?

If this name aligns with your intent, could you also update the function names, comments, and documentation accordingly? If there’s any discrepancy with your intended functionality, please feel free to let me know. 😊

…sposal of children

- Renamed `forceReloadIndexes` to `autoDisposeIndexes` to better reflect its purpose.
- Added comments and updated parameters to align with the new feature.
- Updated documentation to replace `forceReloadIndexes` with `autoDisposeIndexes`.
- Added explanation of the `autoDisposeIndexes` feature under the Features section.
- Updated example code to include `autoDisposeIndexes` usage.
- Improved parameter descriptions and provided real-world use case examples.
@colonal
Copy link
Contributor Author

colonal commented Jan 28, 2025

@okaryo
Thank you for the suggestion! 🙌
I have updated the name from forceReloadIndexes to autoDisposeIndexes as recommended. The changes have been reflected in the code, comments, and documentation, including the README file. Let me know if there’s anything else you’d like me to adjust! 😊

@okaryo okaryo changed the title Add forceReloadIndexes and _updateChildrenForReload for Enhanced LazyLoadIndexedStack Control Add autoDisposeIndexes to dispose unused IndexedStack children and rebuild them when needed Jan 28, 2025
Copy link
Owner

@okaryo okaryo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you for your contribution!
I'll merge it. 🚀

@okaryo okaryo merged commit d2fd77d into okaryo:main Jan 28, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants