Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ref: Streamline loading replays for hydration diffs in Issue Details #88028

Merged
merged 5 commits into from
Mar 31, 2025

Conversation

ryan953
Copy link
Member

@ryan953 ryan953 commented Mar 26, 2025

Before we had two 'placeholder' thing that would render while we wait for the hydration diff preview to load up:

  • A <LoadingIndicator /> while we're lazy-loading the replayDiffContent.tsx file
  • Then <Placeholder/> while we load the replay data over ajax

This resulted in janky loading swapping one placeholder for another.

Also, we weren't properly handling all loading states before, so if the replay was missing or archived it looked janky. Now that <ReplayLoadingState> is in place, all cases are handled. For example:

Before After
SCR-20250326-mjkc SCR-20250326-mjmr

Along the way i changed the interface to the new <ReplayLoadingState>. Now it takes the result of useLoadReplayReader as a prop. This will make it possible to separate loading and rendering, so we can deal with logging that sometimes happens, or in the case of Traces, the loading happens very far away and props get drilled down.

@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Mar 26, 2025
@ryan953 ryan953 requested review from a team March 26, 2025 20:54
Copy link

codecov bot commented Mar 26, 2025

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
10039 1 10038 5
View the top 1 failed test(s) by shortest run time
provisionSubscriptionAction retains on-demand budget when toggled
Stack Traces | 10.1s run time
Error: thrown: "Exceeded timeout of 10000 ms for a test.
Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."
    at .../gsAdmin/components/provisionSubscriptionAction.spec.tsx:490:3
    at _dispatchDescribe (.../jest-circus/build/index.js:91:26)
    at describe (.../jest-circus/build/index.js:55:5)
    at Object.<anonymous> (.../gsAdmin/components/provisionSubscriptionAction.spec.tsx:14:1)
    at Runtime._execModule (.../jest-runtime/build/index.js:1439:24)
    at Runtime._loadModule (.../jest-runtime/build/index.js:1022:12)
    at Runtime.requireModule (.../jest-runtime/build/index.js:882:12)
    at jestAdapter (.../build/legacy-code-todo-rewrite/jestAdapter.js:77:13)
    at processTicksAndRejections (node:internal/process/task_queues:105:5)
    at runTestInternal (.../jest-runner/build/runTest.js:367:16)
    at runTest (.../jest-runner/build/runTest.js:444:34)
    at Object.worker (.../jest-runner/build/testWorker.js:106:12)

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

Comment on lines 33 to 44
function wrapInSection(render: () => ReactNode) {
return function () {
return (
<InterimSection
type={SectionKey.HYDRATION_DIFF}
title={t('Hydration Error Diff')}
>
{render()}
</InterimSection>
);
};
}
Copy link
Member

Choose a reason for hiding this comment

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

just pull this out into a component with children?

Copy link
Member Author

Choose a reason for hiding this comment

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

@scttcper it gets formatted out to more line if it's a React component :(

Copy link
Member

Choose a reason for hiding this comment

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

that seems fine

return (
<Fragment>
{input}
{render(replaySlug)}
Copy link
Member

Choose a reason for hiding this comment

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

imo it's kind of confusing to have two different rendering methods in this component -- I don't really know how they're used but what if they were two components ReplaySlugChooser and ReplaySlugChooserWithLoaderStuff

Copy link
Member Author

Choose a reason for hiding this comment

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

i'll pass back over this chooser and clean it up.

it's used by some /stories/ files so people can load up real reply data and see the video components working together, so the two interfaces kind of optimize for keeping the stories readable right now.

@ryan953 ryan953 merged commit 174068d into master Mar 31, 2025
40 checks passed
@ryan953 ryan953 deleted the ryan953/ref-replay-hydration-diff-loading branch March 31, 2025 15:38
andrewshie-sentry pushed a commit that referenced this pull request Mar 31, 2025
…88028)

Before we had two 'placeholder' thing that would render while we wait
for the hydration diff preview to load up:
- A `<LoadingIndicator />` while we're lazy-loading the
`replayDiffContent.tsx` file
- Then `<Placeholder/>` while we load the replay data over ajax

This resulted in janky loading swapping one placeholder for another.

Also, we weren't properly handling all loading states before, so if the
replay was missing or archived it looked janky. Now that
`<ReplayLoadingState>` is in place, all cases are handled. For example:

| Before | After |
| --- | --- |
| <img width="846" alt="SCR-20250326-mjkc"
src="https://github.com/user-attachments/assets/68053fcf-5a2d-44aa-850f-f85255e5526e"
/> | <img width="841" alt="SCR-20250326-mjmr"
src="https://github.com/user-attachments/assets/c7ffbbcc-9193-46ea-8f37-1df3e4245dac"
/> |


Along the way i changed the interface to the new `<ReplayLoadingState>`.
Now it takes the result of `useLoadReplayReader` as a prop. This will
make it possible to separate loading and rendering, so we can deal with
logging that sometimes happens, or in the case of Traces, the loading
happens very far away and props get drilled down.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Frontend Automatically applied to PRs that change frontend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants