Skip to content

⚡ Bolt: Optimize PasswordScreen FlatList rendering - #185

Open
TargetMisser wants to merge 1 commit into
mainfrom
bolt-password-flatlist-optimization-10315265784027846532
Open

⚡ Bolt: Optimize PasswordScreen FlatList rendering#185
TargetMisser wants to merge 1 commit into
mainfrom
bolt-password-flatlist-optimization-10315265784027846532

Conversation

@TargetMisser

Copy link
Copy Markdown
Owner

💡 What:
Extracted renderItem using useCallback in PasswordScreen.tsx and modified the PasswordRowComponent callbacks to prevent inline arrow function instantiation during rendering. Added windowSize={5} to FlatList.

🎯 Why:
Using inline arrow functions for renderItem and item callbacks creates new function references on every render. This completely defeated the React.memo wrapping on PasswordRow, forcing re-renders for every single item in the list even if nothing changed.

📊 Impact:
Significantly reduces re-renders of the password list. Reduces memory footprint and CPU cycles, making scrolling and screen interactions noticeably smoother, especially as the user adds more items to their password manager.

🔬 Measurement:
You can verify the improvement by using the React DevTools Profiler while typing a PIN or interacting with the screen. You'll see PasswordRow no longer re-renders unnecessarily compared to the previous state.


PR created automatically by Jules for task 10315265784027846532 started by @TargetMisser

Extracted FlatList renderItem into a memoized useCallback and stabilized row callbacks to prevent unnecessary re-renders of the entire list. Also added windowSize to reduce memory footprint.

Co-authored-by: TargetMisser <52361977+TargetMisser@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@vercel

vercel Bot commented May 9, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
flight-work-app Ready Ready Preview, Comment, Open in v0 May 9, 2026 1:46am

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a0c58960fd

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +283 to +289
const renderItem = useCallback(({ item }: { item: PasswordEntry }) => (
<PasswordRow
item={item}
onEdit={openEdit}
onDelete={deleteEntry}
/>
), [openEdit, deleteEntry]);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Move renderItem hook before PIN early returns

When pinMode switches from null to 'unlock' or 'setup' after a normal render, this new useCallback is skipped because the component returns the PIN overlay above it, changing the hook order between renders. That breaks the PIN flows with React's “rendered fewer hooks than expected” runtime error; define this hook before the pinMode early returns or avoid using a hook here.

Useful? React with 👍 / 👎.

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.

1 participant