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

chore(rsc): Remove client.ts and clean-up outdated tests #11527

Merged
merged 1 commit into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ describe('page auto loader correctly imports pages', () => {
})

test('RSC specific code should not be added', () => {
expect(result?.code).not.toContain(
'import { renderFromRscServer } from "@redwoodjs/vite/client"',
)
expect(result?.code).not.toContain('DummyComponent')
expect(result?.code).not.toContain('= () => {}')
})
})
173 changes: 0 additions & 173 deletions packages/vite/src/client.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ describe('rscRoutesAutoLoader', () => {
)

// What we are interested in seeing here is:
// - The import of `renderFromRscServer` from `@redwoodjs/vite/client`
// - The call to `renderFromRscServer` for each page that wasn't already imported
// - Creation of `const EmptyUserNewEmptyUserPage = () => null;` etc for each page
// - The import of `dummyComponent` from `@redwoodjs/router/dist/dummyComponent`
expect(output).toMatchInlineSnapshot(`
"const EmptyUserNewEmptyUserPage = () => null;
const EmptyUserEmptyUsersPage = () => null;
Expand Down Expand Up @@ -364,9 +364,8 @@ describe('rscRoutesAutoLoader', () => {
undefined,
)

// We don't have to add calls for the AboutPage as it was already imported
expect(output).not.toContain('renderFromDist("AboutPage")')
expect(output).not.toContain('renderFromRscServer("AboutPage")')
// We should't create a stub component for the AboutPage as it was already imported
expect(output).not.toContain('const AboutPage = () => null')
})
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,10 @@ describe('rscRoutesAutoLoader', () => {
)

// What we are interested in seeing here is:
// - There's a CLIENT_REFERENCE
// - There's a registerClientReference import
// - There's a Link export
// - There's a proper $$id
// - There's a registerClientReference call with the path to the built link
// component dist file
expect(output).toMatchInlineSnapshot(`
"import {registerClientReference} from "react-server-dom-webpack/server";
export const Link = registerClientReference(function() {throw new Error("Attempted to call Link() from the server but Link is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.");},"/Users/tobbe/rw-app/web/dist/rsc/assets/rsc-link.js-13.mjs","Link")
Expand Down Expand Up @@ -155,8 +156,8 @@ describe('rscRoutesAutoLoader', () => {
)

// What we are interested in seeing here is:
// - The import of `renderFromRscServer` from `@redwoodjs/vite/client`
// - The call to `renderFromRscServer` for each page that wasn't already imported
// - The import of `registerClientReference` from `react-server-dom-webpack/server`
// - The export of all of the individual components
expect(output).toMatchInlineSnapshot(`
"import {registerClientReference} from "react-server-dom-webpack/server";
export const CheckmarkIcon = registerClientReference(function() {throw new Error("Attempted to call CheckmarkIcon() from the server but CheckmarkIcon is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.");},"/Users/tobbe/rw-app/web/dist/rsc/assets/rsc-index.js-15.mjs","CheckmarkIcon")
Expand Down
Loading