Skip to content

fix(discover-homepage): Fix flicker when loading homepage#39905

Merged
narsaynorath merged 6 commits into
masterfrom
nar/fix/discover-homepage-flicker-on-redirect
Oct 12, 2022
Merged

fix(discover-homepage): Fix flicker when loading homepage#39905
narsaynorath merged 6 commits into
masterfrom
nar/fix/discover-homepage-flicker-on-redirect

Conversation

@narsaynorath

@narsaynorath narsaynorath commented Oct 12, 2022

Copy link
Copy Markdown
Member

The homepage relies on a fetch request to complete and a redirect to occur before getting events data (events-stats, events, events-meta). There is a gap by implementing a redirect in the child of AsyncComponent where the discover charts load up with the event view, but the page filters aren't set. If projects need to be loaded, this redirect occurs and then triggers another series of fetches. If the first series completes then there will be a flicker when the final state loads.

My fix here essentially treats the first render of the homepage view as an invalid event view. That way we can wait until the checkEventView function handles the redirecting and sets the page filters and gives us a valid event view. This reduces how many places we're handling redirect logic because I was able to move it out of the HomepageQueryAPI component.

Flickers are hard to test for, so I'm relying on the existing tests to check for functionality.

The homepage relies on a fetch request to complete and a redirect to
occur before getting events data. There is a gap by implementing a
redirect in the child of AsyncComponent where the discover charts load
up with the default event view. If projects need to be loaded, this
redirect occurs and then triggers another series of fetches. If the
first series completes then there will be a flicker when the final state
loads.
@github-actions

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size
src/sentry/static/sentry/dist/entrypoints/app.js 20.29 KB (-0.02% 🔽)
src/sentry/static/sentry/dist/entrypoints/sentry.css 33.05 KB (0%)

@edwardgou-sentry edwardgou-sentry 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.

small comment

Comment thread static/app/views/eventsV2/results.tsx Outdated
@narsaynorath narsaynorath enabled auto-merge (squash) October 12, 2022 16:27
@narsaynorath narsaynorath merged commit a4e5875 into master Oct 12, 2022
@narsaynorath narsaynorath deleted the nar/fix/discover-homepage-flicker-on-redirect branch October 12, 2022 16:38
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants