Skip to content
This repository was archived by the owner on Apr 6, 2023. It is now read-only.
/frameworkPublic archive

feat(nuxt): wrap #components client exports with createClientOnly - #7412

Merged
danielroe merged 19 commits into
nuxt:mainfrom
huang-julien:fix/#components-import
Oct 11, 2022
Merged

feat(nuxt): wrap #components client exports with createClientOnly#7412
danielroe merged 19 commits into
nuxt:mainfrom
huang-julien:fix/#components-import

Conversation

@huang-julien

Copy link
Copy Markdown
Member

🔗 Linked issue

resolvenuxt/nuxt#14755 , related nuxt/nuxt#14868

❓ Type of change

  • 📖 Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

hi ! i'm not sure if this should be considered as bug fix or feature. This PR allow importing .client component as client only components when using explicit imports from #components. It also adds ServerPlaceholder as the .client server-side fallback if there's no .server component to avoid hydration issues.

📝 Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@netlify

netlifyBot commented Sep 11, 2022

Copy link
Copy Markdown

Deploy Preview for nuxt3-docs ready!

NameLink
🔨 Latest commit94c6f28
🔍 Latest deploy loghttps://app.netlify.com/sites/nuxt3-docs/deploys/634578f4f75bf8000885eec8
😎 Deploy Previewhttps://deploy-preview-7412--nuxt3-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@huang-julien
huang-julien marked this pull request as draft September 12, 2022 06:56
@huang-julien

Copy link
Copy Markdown
MemberAuthor

convert to draft due to lazy loaded client components not being lazy loaded

@huang-julien
huang-julien marked this pull request as ready for review September 12, 2022 11:26
@huang-julien

huang-julien commented Oct 3, 2022

Copy link
Copy Markdown
MemberAuthor

Hi 👋 @danielroe@pi0
Importing from "#components" automatically break the tests due to BreakServer being exported in components.server.mjs.
It happens also on the edge channel.
Do you have any tips or solution to test this ? Maybe renaming BreakServer to BreakServer.client ? this shouldn't break the test of /client since the import is done with it's path.

@danielroe

Copy link
Copy Markdown
Member

I'd be happy with renaming BreaksServer 👍 Would you confirm that this still preserve the integrity of the test? (That is, that if you set experimental.treeshakeClientOnly to false, the test breaks.)

@huang-julien

huang-julien commented Oct 4, 2022

Copy link
Copy Markdown
MemberAuthor

setting treeshakeClientOnly to false does not break the tests 👍 (might need to rerun the ci juste to be sure but this does not throw any error locally). let me know what you think of this 🙂 .

@danielroe
danielroe self-requested a review October 9, 2022 19:55
@danielroedanielroe added bug Something isn't working 🔨 p3-minor-bug Priority 3: a bug in an edge case that only affects very specific usage labels Oct 9, 2022
@danielroedanielroe mentioned this pull request Oct 9, 2022
Comment threadpackages/nuxt/src/components/scan.ts Outdated
@danielroe
danielroe requested a review from antfuOctober 10, 2022 10:20
Comment threadpackages/nuxt/src/components/module.ts Outdated
@danielroedanielroe changed the title feat(nuxt): convert .client component with createClientOnly in #componentsfeat(nuxt): wrap #components client exports with createClientOnlyOct 11, 2022
@danielroe
danielroe merged commit ee41bb6 into nuxt:mainOct 11, 2022
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

3.xbugSomething isn't working🔨 p3-minor-bugPriority 3: a bug in an edge case that only affects very specific usage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Explicit import from #component of .client components throws an error server side

2 participants

@huang-julien@danielroe