-
-
Notifications
You must be signed in to change notification settings - Fork 82
feat: add loading and error widget support for StacNetworkWidget #390
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
base: dev
Are you sure you want to change the base?
Conversation
Add optional loadingWidget and errorWidget fields to StacNetworkWidget to allow custom widgets to be displayed during network request states. - Add loadingWidget and errorWidget as optional StacWidget? fields - Update StacNetworkWidgetParser to parse and pass widgets to Stac.fromNetwork - Update documentation with examples showing loading and error states
WalkthroughAdds optional Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
| return Stac.fromNetwork( | ||
| context: context, | ||
| request: model.request, | ||
| loadingWidget: model.loadingWidget != null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should have some default loading widget
Refactor the loading widget in StacNetworkWidgetParser to ensure a consistent loading experience by using Center with CircularProgressIndicator. This change improves the visual feedback during network requests.
…/stac into mn/network-widget-loader
Description
This PR adds support for custom loading and error widgets in the
StacNetworkWidget. Users can now provide optionalloadingWidgetanderrorWidgetproperties that will be displayed during the network request lifecycle.Changes:
loadingWidgetanderrorWidgetas optionalStacWidget?fields toStacNetworkWidgetStacNetworkWidgetParserto parse these widgets and pass them toStac.fromNetworkas builder functionsExample Usage:
{ "type": "networkWidget", "request": { "actionType": "networkRequest", "url": "https://example.com/data", "method": "get" }, "loadingWidget": { "type": "center", "child": { "type": "circularProgressIndicator" } }, "errorWidget": { "type": "center", "child": { "type": "text", "data": "Failed to load" } } }Related Issues
Closes #243
Type of Change
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.