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

feat: add initial RSC support #6646

Merged
merged 1 commit into from Jul 4, 2023
Merged

feat: add initial RSC support #6646

merged 1 commit into from Jul 4, 2023

Conversation

kyletsang
Copy link
Member

Closes #6475

Enables the plugin to add use client into all of the components.

Found some issues though:

1. Cannot use a component that has been created with createWithBsPrefix. For example: CardGroup

Error: Attempted to call the default export of createWithBsPrefix.js from the server but it's 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.

Potential solution:
We would need to stop using this function to create components.

2. Cannot use a component that's been set as a property. For example Accordion.Body

Error: Unsupported Server Component type: undefined
    at stringify (<anonymous>)

Potential solution:
Users would have to import the component separately import AccordionBody from 'react-bootstrap/AccordionBody'

@kyletsang kyletsang marked this pull request as draft June 30, 2023 06:47
@jquense
Copy link
Member

jquense commented Jun 30, 2023

Thanks for doing the initial work. These restrictions from react feel so arbitrary...I thought the point of "use client" was that the components would just work, it's strange that there are these additional bonus things.

Do we know if they are RSC or next restrictions and are they temporary/short term maybe? I guess the work arounds aren't a too bad but it's pretty annoying to have to copy paste a bunch of factories as well as export everything

@kyletsang
Copy link
Member Author

kyletsang commented Jun 30, 2023

The first one looks like a limitation of RSC whereas the second issue looks like a bug. I might just publish a beta of RB so I can post an issue with repro into the nextjs github board. I'd like some definitive answers since I couldn't find much in my searches.

@kyletsang kyletsang marked this pull request as ready for review July 4, 2023 05:52
@kyletsang kyletsang merged commit 6a5078f into master Jul 4, 2023
13 checks passed
@kyletsang kyletsang deleted the rsc-support branch July 4, 2023 05:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support NextJS 13 /app directory server-side rendering?
2 participants