Skip to content

Commit

Permalink
Merge branch 'main' into canary-ci-2-fix-2
Browse files Browse the repository at this point in the history
  • Loading branch information
dai-shi committed Dec 12, 2024
2 parents 9216ce5 + 486d0ad commit 9e39f0e
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 2 deletions.
18 changes: 18 additions & 0 deletions e2e/fixtures/hot-reload/src/pages/about.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { Link } from 'waku';

export default async function AboutPage() {
return (
<div>
<p>About Page</p>
<Link to="/" data-testid="home">
Return home
</Link>
</div>
);
}

export const getConfig = async () => {
return {
render: 'static',
} as const;
};
5 changes: 5 additions & 0 deletions e2e/fixtures/hot-reload/src/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import { Link } from 'waku';

import { Counter } from '../components/counter.js';

export default async function HomePage() {
return (
<div>
<p>Home Page</p>
<Counter />
<Link to="/about" data-testid="about">
About
</Link>
</div>
);
}
Expand Down
9 changes: 8 additions & 1 deletion e2e/hot-reload.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ test.describe('hot reload', () => {
});
});

test('simple case', async ({ page }) => {
test('server and client', async ({ page }) => {
const [port, pid] = await run();
await page.goto(`http://localhost:${port}/`);
await expect(page.getByText('Home Page')).toBeVisible();
Expand Down Expand Up @@ -115,6 +115,13 @@ test.describe('hot reload', () => {
await expect(page.getByTestId('count')).toHaveText('3');
await page.getByTestId('increment').click();
await expect(page.getByTestId('count')).toHaveText('4');
// Jump to another page and back
await page.getByTestId('about').click();
await expect(page.getByText('About Page')).toBeVisible();
await modifyFile('src/pages/about.tsx', 'About Page', 'About2 Page');
await expect(page.getByText('About2 Page')).toBeVisible();
await page.getByTestId('home').click();
await expect(page.getByText('Edited Page')).toBeVisible();
await terminate(pid!);
});
});
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"test": "prettier -c . && eslint . && tsc -b && tsc -b --noEmit `find examples -mindepth 1 -maxdepth 1 -type d ! -name '*_js'` && pnpm run --filter waku test",
"test-vite-ecosystem-ci": "pnpm run --filter waku test && playwright test --project=chromium",
"e2e": "playwright test",
"website:dev": "(cd packages/website && pnpm run dev)",
"website:dev": "cd packages/website && pnpm run dev",
"website:build": "cd packages/website && pnpm run build",
"website:vercel": "pnpm run compile && pnpm run website:build --with-vercel-static && mv packages/website/.vercel/output .vercel/",
"website:prd": "pnpm run website:build && (cd packages/website && pnpm start)"
Expand Down
2 changes: 2 additions & 0 deletions packages/waku/src/lib/plugins/vite-plugin-rsc-hmr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ export function rscHmrPlugin(): Plugin {
`
{
const refetchRoute = () => {
cachedIdSet.clear();
staticPathSet.clear();
const rscPath = encodeRoutePath(route.path);
const rscParams = createRscParams(route.query, []);
refetch(rscPath, rscParams);
Expand Down

0 comments on commit 9e39f0e

Please sign in to comment.