Skip to content

Conversation

@DealsBeam
Copy link

No description provided.

google-labs-jules bot and others added 2 commits January 3, 2026 14:27
Refactors the script loading logic in the `HomeScreen` component to prevent unnecessary re-renders and improve startup performance.

- Extracts script loading to a separate `lib/script.ts` module.
- Caches the script-loading promise to ensure the script is fetched only once per application session.
- Replaces the `useEffect`/`useState` pattern with the `use()` hook to suspend rendering while the script is loading.
- Adds a `<Suspense>` boundary in the root layout to handle the suspended component.

This change eliminates an unnecessary re-render cycle on the home screen, leading to a faster and smoother application startup.
…4225115407549

Optimize script loading to reduce re-renders

// Cache the promise to ensure the script is only fetched once.
// This prevents redundant work if the component using this script
// re-mounts multiple times.
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for contributing, we only have one route currently, so app/index.tsx won't be re-mounted
image

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

Successfully merging this pull request may close these issues.

2 participants