-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Update index.html #8267
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: main
Are you sure you want to change the base?
Update index.html #8267
Conversation
Reviewer's GuideThis PR refactors index.html to streamline PWA metadata, update branding, add a loading spinner, and tweak the service worker bootstrap logic to hide the spinner once the app loads. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
updated html |
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.
Hey there - I've reviewed your changes - here's some feedback:
- Reintroduce a timeout fallback to load main.dart.js in case service worker registration stalls, so the loading spinner doesn’t persist indefinitely.
- Extract the inline spinner CSS into a separate stylesheet or component to keep styles modular and themeable.
- Include a comment or script to dynamically set when deploying under a subpath, since that configuration was removed.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Reintroduce a timeout fallback to load main.dart.js in case service worker registration stalls, so the loading spinner doesn’t persist indefinitely.
- Extract the inline spinner CSS into a separate stylesheet or component to keep styles modular and themeable.
- Include a comment or script to dynamically set <base href> when deploying under a subpath, since that configuration was removed.
## Individual Comments
### Comment 1
<location> `frontend/appflowy_flutter/web/index.html:56` </location>
<code_context>
+
+ function loadMainDartJs() {
+ // NEW: Hide indicator before starting the main Dart script load
+ hideLoadingIndicator();
+
+ if (scriptLoaded) {
</code_context>
<issue_to_address>
**suggestion (bug_risk):** The loading indicator is hidden before the main Dart script is loaded, which may cause a brief flash of uninitialized UI.
Hide the loading indicator after the Dart script has loaded and the app is initialized to prevent users from seeing incomplete UI.
Suggested implementation:
```
function loadMainDartJs() {
// Hide indicator AFTER the main Dart script has loaded and app is initialized
if (scriptLoaded) {
return;
}
scriptLoaded = true;
var scriptTag = document.createElement('script');
scriptTag.src = 'main.dart.js';
scriptTag.type = 'application/javascript';
scriptTag.addEventListener('load', function() {
// Optionally, you may want to wait for Dart app initialization here
hideLoadingIndicator();
});
document.body.append(scriptTag);
}
```
If your Dart app exposes a global callback or event for when initialization is complete (e.g., `window.flutterAppInitialized`), you should call `hideLoadingIndicator()` in that callback instead of the script's `load` event. Adjust as needed for your app's initialization flow.
</issue_to_address>
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
||
function loadMainDartJs() { | ||
// NEW: Hide indicator before starting the main Dart script load | ||
hideLoadingIndicator(); |
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.
suggestion (bug_risk): The loading indicator is hidden before the main Dart script is loaded, which may cause a brief flash of uninitialized UI.
Hide the loading indicator after the Dart script has loaded and the app is initialized to prevent users from seeing incomplete UI.
Suggested implementation:
function loadMainDartJs() {
// Hide indicator AFTER the main Dart script has loaded and app is initialized
if (scriptLoaded) {
return;
}
scriptLoaded = true;
var scriptTag = document.createElement('script');
scriptTag.src = 'main.dart.js';
scriptTag.type = 'application/javascript';
scriptTag.addEventListener('load', function() {
// Optionally, you may want to wait for Dart app initialization here
hideLoadingIndicator();
});
document.body.append(scriptTag);
}
If your Dart app exposes a global callback or event for when initialization is complete (e.g., window.flutterAppInitialized
), you should call hideLoadingIndicator()
in that callback instead of the script's load
event. Adjust as needed for your app's initialization flow.
updated |
Feature Preview
PR Checklist
Summary by Sourcery
Revamp the web entrypoint index.html to apply AppFlowy branding, streamline meta tags, and enhance the user experience with a CSS-based loading spinner that is hidden once the main Flutter script loads.
Enhancements: