Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Comments

chore: do not prefetch RouterLink on new architecture#12832

Merged
MounirDhahri merged 1 commit intomainfrom
chore/do-not-use-sentinel-on-new-architecture
Oct 10, 2025
Merged

chore: do not prefetch RouterLink on new architecture#12832
MounirDhahri merged 1 commit intomainfrom
chore/do-not-use-sentinel-on-new-architecture

Conversation

@MounirDhahri
Copy link
Member

@MounirDhahri MounirDhahri commented Oct 10, 2025

This PR resolves PHIRE-2389

Description

This PR disables prefetching RouterLink components on the new architecture. This change is required in order to make the home view usable.

Rationale:
Currently, our Sentinel component creates an interval on RouterLink to measure components position. We do that so:

useEffect(() => {
    startWatching()
    return stopWatching
  }, [])

  const startWatching = () => {
    if (interval) {
      return
    }

    interval = setInterval(() => {
      if (!myView || !myView.current) {
        return
      }

      myView.current.measure(
        async (_args) => {
          isInViewPort(_args)
        }
      )
    }, 1000)
  }

The latter was fine in the old architecture and didn't lead to a performance degradation, however in the new architecture, it plummeted the performance and had a big impact on the CPU load.

Hopefully, we will find a replacement to keep a similar experience and find an alternative to our Sentinel. I will look into doing this on a different thread later to see if we can offset the load

After After
Screenshot 2025-10-10 at 14 43 26 Screenshot 2025-10-10 at 14 43 31

PR Checklist

  • I have tested my changes on the following platforms:
    • Android.
    • iOS.
  • I hid my changes behind a feature flag, or they don't need one.
  • I have included screenshots or videos at least on Android, or I have not changed the UI.
  • I have added tests, or my changes don't require any.
  • I added an app state migration, or my changes do not require one.
  • I have documented any follow-up work that this PR will require, or it does not require any.
  • I have added a changelog entry below, or my changes do not require one.

To the reviewers 👀

  • I would like at least one of the reviewers to run this PR on the simulator or device.
Changelog updates

Changelog updates

Cross-platform user-facing changes

iOS user-facing changes

Android user-facing changes

Dev changes

  • do not prefetch RouterLink on new architecture - mounir

Need help with something? Have a look at our docs, or get in touch with us.

@ArtsyOpenSource
Copy link
Contributor

This PR contains the following changes:

  • Dev changes (do not prefetch RouterLink on new architecture - mounir - MounirDhahri)

Generated by 🚫 dangerJS against bce0c84

Copy link
Contributor

@brainbicycle brainbicycle left a comment

Choose a reason for hiding this comment

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

this looks reasonable to me, and the check is great! can we bring back to mobile practice to get opinions? I think ideal state is to have prefetching possible in new architecture if possible but we have some time

@MounirDhahri
Copy link
Member Author

@brainbicycle yesss that's the plan - I am planning on discussing it with @olerichter00 further and Chriss when he's back

@brainbicycle
Copy link
Contributor

@brainbicycle yesss that's the plan - I am planning on discussing it with @olerichter00 further and Chriss when he's back

great! to be clear i think fine to merge gated behind the flag in the meantime!

@MounirDhahri
Copy link
Member Author

@brainbicycle I updated the PR description to include the context from our DMs

@MounirDhahri MounirDhahri merged commit 6212714 into main Oct 10, 2025
7 checks passed
@MounirDhahri MounirDhahri deleted the chore/do-not-use-sentinel-on-new-architecture branch October 10, 2025 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants