GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add ReactDOMClient to ServerIntegration(Hooks|NewContext) by rickhanlonii · Pull Request #28135 · react/react

Add ReactDOMClient to ServerIntegration(Hooks|NewContext) #28135

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.

Sign up for GitHub

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

Merged
rickhanlonii merged 3 commits into main from rh/server-test-utils-hooks
Feb 1, 2024

Uh oh!

There was an error while loading. Please reload this page.

Merged

Add ReactDOMClient to ServerIntegration(Hooks|NewContext) #28135

Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit Hold shift + click to select a range
e204d76
Add ReactDOMClient to ServerIntegrationTestUtils
rickhanlonii Jan 27, 2024
b200a8b
Add ReactDOMClient to ServerIntegrationHooks
rickhanlonii Jan 28, 2024
1365876
Handle different error counts depending on renderer
Jan 28, 2024
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view
Prev Previous commit
Handle different error counts depending on renderer
  • Loading branch information

Uh oh!

There was an error while loading. Please reload this page.

Sebastian Silbermann @rickhanlonii
Sebastian Silbermann authored and rickhanlonii committed Feb 1, 2024
commit 13658763d40fc6883f7822502a4a45f8e11b9c35

There are no files selected for viewing

37 changes: 28 additions & 9 deletions 37 packages/react-dom/src/__tests__/ReactDOMServerIntegrationHooks-test.js
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,13 @@ function initModules() {
};
}

const {resetModules, itRenders, itThrowsWhenRendering, serverRender} =
ReactDOMServerIntegrationUtils(initModules);
const {
resetModules,
itRenders,
itThrowsWhenRendering,
clientRenderOnBadMarkup,
serverRender,
} = ReactDOMServerIntegrationUtils(initModules);

describe('ReactDOMServerHooks', () => {
beforeEach(() => {
Expand Down Expand Up @@ -422,8 +427,13 @@ describe('ReactDOMServerHooks', () => {
});
return 'hi';
}
// TODO: fails due to render error retry
const domNode = await render(<App />, 1);
const domNode = await render(
<App />,
render === clientRenderOnBadMarkup
Comment thread

@eps1lon eps1lon Jan 28, 2024

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

We use this pattern in other tests as well. E.g. packages/react-dom/src/__tests__/ReactDOMServerIntegrationElements-test.js makes extensive usage of assertions based on the renderer.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@rickhanlonii rickhanlonii Jan 28, 2024

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Oh snap nice

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
? // On hydration mismatch we retry and therefore log the warning again.
2
: 1,
);
expect(domNode.textContent).toEqual('hi');
});

Expand All @@ -436,8 +446,13 @@ describe('ReactDOMServerHooks', () => {
return value;
}

// TODO: fails due to render error retry
const domNode = await render(<App />, 1);
const domNode = await render(
<App />,
render === clientRenderOnBadMarkup
? // On hydration mismatch we retry and therefore log the warning again.
2
: 1,
);
expect(domNode.textContent).toEqual('0');
});
});
Expand Down Expand Up @@ -860,11 +875,15 @@ describe('ReactDOMServerHooks', () => {
return <Text text={count} />;
}

// TODO: fails due to render error retry
const domNode1 = await render(<ReadInMemo />, 1);
const domNode1 = await render(
<ReadInMemo />,
render === clientRenderOnBadMarkup
? // On hydration mismatch we retry and therefore log the warning again.
2
: 1,
);
expect(domNode1.textContent).toEqual('42');

// TODO: fails due to render error retry
const domNode2 = await render(<ReadInReducer />, 1);
expect(domNode2.textContent).toEqual('42');
});
Expand Down
24 changes: 17 additions & 7 deletions 24 packages/react-dom/src/__tests__/ReactDOMServerIntegrationNewContext-test.js
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ function initModules() {
};
}

const {resetModules, itRenders} = ReactDOMServerIntegrationUtils(initModules);
const {resetModules, itRenders, clientRenderOnBadMarkup} =
ReactDOMServerIntegrationUtils(initModules);

describe('ReactDOMServerIntegration', () => {
beforeEach(() => {
Expand Down Expand Up @@ -365,9 +366,13 @@ describe('ReactDOMServerIntegration', () => {
</div>
);
};
// TODO: fails due to render error retry
// We expect 1 error.
await render(<App />, 1);
await render(
<App />,
render === clientRenderOnBadMarkup
? // On hydration mismatch we retry and therefore log the warning again.
2
: 1,
);
},
);

Expand All @@ -392,9 +397,14 @@ describe('ReactDOMServerIntegration', () => {
</div>
);
};
// TODO: fails due to render error retry
// We expect 1 error.
await render(<App />, 1);

await render(
<App />,
render === clientRenderOnBadMarkup
? // On hydration mismatch we retry and therefore log the warning again.
2
: 1,
);
},
);

Expand Down
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
You are visitor 01402809 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.