Skip to content

Only reload tabbar if something meaningful changed#2729

Merged
ifosli merged 2 commits into
mainfrom
ifosli/stopConstantTabbarReload
Jan 29, 2026
Merged

Only reload tabbar if something meaningful changed#2729
ifosli merged 2 commits into
mainfrom
ifosli/stopConstantTabbarReload

Conversation

@ifosli

@ifosli ifosli commented Jan 28, 2026

Copy link
Copy Markdown
Contributor

📲 What

Instead of reloading the tab bar every time the app's been backgrounded, ensure the view controllers only get regenerated if a) the tabbar flag changed value b) the login status changed or c) the user locale changed.

🤔 Why

Reloading the app each time it's been backgrounded is very annoying for users

👀 See

Before 🐛 After 🦋
Simulator Screen Recording - iPhone 16 Plus - 2026-01-28 at 12 49 10 Simulator Screen Recording - iPhone 16 Plus - 2026-01-28 at 12 45 47

✅ Acceptance criteria

  • App no longer reloads when it's just been backgrounded
  • App reloads when locale changes
  • App reloads when tabbar flag value changes and then the app is backgrounded

@ifosli ifosli self-assigned this Jan 28, 2026
@ifosli ifosli force-pushed the ifosli/stopConstantTabbarReload branch from 73d7082 to 1d968ff Compare January 28, 2026 20:24
@ifosli ifosli force-pushed the ifosli/stopConstantTabbarReload branch from 1d968ff to 8ea2fe8 Compare January 28, 2026 20:25
Comment thread Library/ViewModels/RootViewModel.swift Outdated

let floatingTabBarEnabled = featuredFlagChanged
.map { _ in featureFloatingTabBarEnabled() }
.skipRepeats()

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This was the "one line change" that I thought this pr would be...

.takeWhen(
Signal.merge(
self.userLocalePreferencesChangedProperty.signal,
featuredFlagChanged.ignoreValues()

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Since the featureFlagChanged signal is considered in the standardViewControllers already, there's no reason it needs to be included here. And now that featureFlagChanged just means that feature flags might've changed, it cannot be included here.

currentUser, floatingTabBarEnabled, .merge(
self.viewDidLoadProperty.signal,
self.userLocalePreferencesChangedProperty.signal,
featuredFlagChanged.ignoreValues()

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Same here; removed featureFlagChanged since it's changed to mean "feature flags might've changed" instead of "feature flags that we care about did change"

viewControllerNames.assertValueCount(1)

self.vm.inputs.currentUserUpdated()
withEnvironment(currentUser: User.template) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added the current user to the environment here to make currentUserUpdated mean something. Happy to delete it again if the goal of this test was to ensure we didn't reload view controllers if "currentUserUpdated()" got called but the user didn't change

self.vm.inputs.userSessionEnded()

viewControllerNames.assertValueCount(4)
viewControllerNames.assertValueCount(3)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This count also changed because we're no longer double emitting on initial load

@ifosli ifosli marked this pull request as ready for review January 28, 2026 20:40
@ifosli ifosli requested a review from scottkicks January 28, 2026 20:40

@scottkicks scottkicks left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Did some testing and it looks like there are some issues with these changes. See GIF

  • The floating tab bar doesn't reload correctly. The icons are wonky.
  • When switching back to the old tab bar there isn't a currently selected (highlighted) tab and the tab labels don't re-appear.

I'm not exactly sure what the fix is, but its definitely related to the changes made outside of adding .skipRepeats(). I checked that.

If you don't have the time or know why this is happening off the top of your head we can file a bug ticket separately since it isn't time sensitive right now.

Sidenote for me. I'm also seeing a new bug unrelated to your changes. Switching from old to new tab bar results in the search tab showing the Activities notification indicator. I created a separate ticket to fix that already. It isn't a release blocker since we're not rolling this out in this release.

Image

@ifosli

ifosli commented Jan 29, 2026

Copy link
Copy Markdown
Contributor Author

Did some testing and it looks like there are some issues with these changes. See GIF

  • The floating tab bar doesn't reload correctly. The icons are wonky.
  • When switching back to the old tab bar there isn't a currently selected (highlighted) tab and the tab labels don't re-appear.

I'm not exactly sure what the fix is, but its definitely related to the changes made outside of adding .skipRepeats(). I checked that.

If you don't have the time or know why this is happening off the top of your head we can file a bug ticket separately since it isn't time sensitive right now.

Good catch! Looks like that weirdness only happens for logged out users, so good find! I've updated the way we use the featuredFlagChanged signal to go back to its original intent. This fixes everything except I think the floating tab bar doesn't render correctly when the app is first launched, for a logged out user. I filed a ticket for this, added it to our next sprint, and assigned it to you. Happy to spend more time looking into it if that'd be helpful; I'm just assuming you'll be quicker at fixing any floating tab bar issues than I'd be!

@ifosli ifosli requested a review from scottkicks January 29, 2026 20:32
@ifosli ifosli merged commit f3834d1 into main Jan 29, 2026
5 checks passed
@ifosli ifosli deleted the ifosli/stopConstantTabbarReload branch January 29, 2026 22:33
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