Skip to content

android: avoid duplicate profile loading on view model initialization - #898

Merged
kari-ts merged 1 commit into
mainfrom
kari/ipnprof
Oct 20, 2026
Merged

kari-ts merged 1 commit into
mainfrom
kari/ipnprof

Conversation

@kari-ts

@kari-ts kari-ts commented Oct 20, 2026

Copy link
Copy Markdown
Collaborator

IpnViewModel explicitly loads user profiles during initialization and also subscribes to Notifier.state, which triggers the same load on every emission. Since Notifier.state is a StateFlow, new collectors immediately receive its current value, so profiles and currentProfile requests are issued twice whenever an IpnViewModel is created.

This removes the redundant explicit load. The initial StateFlow emission still loads profiles, and then subsequent state transitions and self node changes continue to trigger refreshes.

pdates tailscale/corp#50274

IpnViewModel explicitly loads user profiles during initialization and also subscribes to Notifier.state, which triggers the same load on every emission. Since Notifier.state is a StateFlow, new collectors immediately receive its current value, so profiles and currentProfile requests are issued twice whenever an IpnViewModel is created.

This removes the redundant explicit load. The initial StateFlow emission still loads profiles, and then subsequent state transitions and self node changes continue to trigger refreshes.

Updates tailscale/corp#50274

Signed-off-by: kari-ts <kari@tailscale.com>
@kari-ts
kari-ts merged commit 9832bc5 into main Oct 20, 2026
5 checks passed
@kari-ts
kari-ts deleted the kari/ipnprof branch October 20, 2026 21:56
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