Skip to content

Commit

Permalink
Verify you can use server:defer on self-imported module (#11577)
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewp authored Jul 30, 2024
1 parent 49db004 commit 60b2766
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
import Self from './Self.astro';
const now = Date();
---

<p class="now">{now}</p>
{!Astro.props.stop && <Self stop server:defer />}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
import Island from '../components/Island.astro';
import Self from '../components/Self.astro';
---

<html>
Expand All @@ -10,5 +11,6 @@ import Island from '../components/Island.astro';
<Island server:defer>
<h3 id="children">children</h3>
</Island>
<Self server:defer />
</body>
</html>
7 changes: 7 additions & 0 deletions packages/astro/e2e/server-islands.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ test.describe('Server islands', () => {

await expect(el, 'element rendered').toBeVisible();
});

test('Self imported module can server defer', async ({ page, astro }) => {
await page.goto(astro.resolveUrl('/base/'));
let el = page.locator('.now');

await expect(el).toHaveCount(2);
});
});

test.describe('Production', () => {
Expand Down

0 comments on commit 60b2766

Please sign in to comment.