Skip to content

perf(mail): cut unnecessary render/listener work in mobile nav#1073

Open
real-venus wants to merge 1 commit into
Stellar-Mail:mainfrom
real-venus:perf/mobile-navigation
Open

perf(mail): cut unnecessary render/listener work in mobile nav#1073
real-venus wants to merge 1 commit into
Stellar-Mail:mainfrom
real-venus:perf/mobile-navigation

Conversation

@real-venus

Copy link
Copy Markdown
Contributor

Summary

Scoped performance pass on the existing Mobile Navigation surface (issue #978). Reduces unnecessary global listeners and per-keystroke re-renders. No behavior, copy, or visual change — strictly fewer wasted renders/listeners.

Closes #978

Hotspots identified (before changing code)

  • Topbar attached a global scroll listener in capture phase that stayed mounted at all times, so it fired on every scroll anywhere in the app (email list, reader panes) even when no dropdown was open and there was nothing to reposition.
  • Sidebar held the new-folder input text in its own state, so typing a folder name re-rendered the entire sidebar nav — every section item and every FolderButton (each a motion.button) — on every keystroke.

Changes

  • Topbar — gate global listenersscroll/resize now subscribe only while a dropdown is open (if (!anyOpen) return). In the common all-closed state, no global listener runs. Reposition-on-open and reposition-on-scroll-while-open behavior is unchanged.
  • Sidebar — isolate add-folder input — extracted AddFolderInput, which owns its own text state. Typing is now scoped to the input; the folder list no longer re-renders per keystroke. Markup, animation, Enter/Escape/cancel behavior all preserved.

Performance note (reasoned)

  • Topbar: eliminates a capture-phase scroll handler during normal scrolling whenever no dropdown is open (i.e. almost always).
  • Sidebar: per-keystroke work in the add-folder flow drops from "re-render the whole sidebar subtree" to "re-render one input".

Scope

2 files, both within the issue's listed paths. No new tool/feature, no real data, no broad refactor.

Scoped performance pass on the existing navigation surface (issue Stellar-Mail#978),
no behavior or visual change.

Topbar: only subscribe to global scroll/resize while a dropdown is open.
The scroll listener uses capture, so previously it fired on every scroll
anywhere in the app (email list, reader) even with no panel to reposition.
Now the listener is detached in the common all-closed state.

Sidebar: extract the add-folder input into its own component that owns its
text state. Typing a folder name previously re-rendered the entire sidebar
nav (all section items and FolderButtons) on every keystroke; that work is
now isolated to the input.

tsc --noEmit clean, lint clean on touched files, unit suite passes (439).
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.

[Existing app][Mobile Navigation] Trim render work and loading latency

1 participant