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

TypeError: ReactSharedInternals is undefined #12886

Closed
1 task
SOG-web opened this issue Jan 3, 2025 · 7 comments
Closed
1 task

TypeError: ReactSharedInternals is undefined #12886

SOG-web opened this issue Jan 3, 2025 · 7 comments
Labels
needs triage Issue needs to be triaged pkg: react Related to React (scope)

Comments

@SOG-web
Copy link

SOG-web commented Jan 3, 2025

Astro Info

Astro                    v5.1.2
Node                     v22.11.0
System                   macOS (x64)
Package Manager          pnpm
Output                   static
Adapter                  @astrojs/node
Integrations             @astrojs/react
                         @astrojs/tailwind
                         @analogjs/astro-angular

If this issue only occurs in one browser, which browser is a problem?

Firefox

Describe the Bug

Am trying to to use Excalidraw in my astro app

<div  style={{ height: "500px" }}>
        <Excalidraw client:only="react" />
    </div>

[astro-island] Error hydrating /node_modules/.vite/deps/@excalidraw_excalidraw.js?v=61f308ba TypeError: error loading dynamically imported module: http://localhost:4321/node_modules/.vite/deps/@excalidraw_excalidraw.js?v=61f308ba

[astro-island] Error hydrating /node_modules/.vite/deps/@excalidraw_excalidraw.js?v=14bf18ac TypeError: ReactSharedInternals is undefined

What's the expected result?

to load Excalidraw

Link to Minimal Reproducible Example

https://github.com/SOG-web/astro-test.git

Participation

  • I am willing to submit a pull request for this issue.
@github-actions github-actions bot added the needs triage Issue needs to be triaged label Jan 3, 2025
@SOG-web
Copy link
Author

SOG-web commented Jan 3, 2025

after more debuging am left with this error

[astro-island] Error hydrating /node_modules/.vite/deps/@excalidraw_excalidraw.js?v=0801ef05 TypeError: ReactSharedInternals is undefined

@ematipico ematipico added the needs repro Issue needs a reproduction label Jan 3, 2025
@ematipico
Copy link
Member

I can't access the repro

Copy link
Contributor

github-actions bot commented Jan 3, 2025

Hello @SOG-web. Please provide a minimal reproduction using a GitHub repository or StackBlitz. Issues marked with needs repro will be closed if they have no activity within 3 days.

@github-actions github-actions bot removed the needs triage Issue needs to be triaged label Jan 3, 2025
@SOG-web
Copy link
Author

SOG-web commented Jan 3, 2025

I can't access the repro

now public, thanks

@bluwy bluwy added pkg: react Related to React (scope) needs triage Issue needs to be triaged and removed needs repro Issue needs a reproduction labels Jan 3, 2025
@darpserj
Copy link

darpserj commented Jan 9, 2025

Hey there! I've played around with trying to add Excalidraw to Astro and here's what I found:

  1. Excalidraw supports react@17 so make sure you're using it
  2. Use the Excalidraw Wrapper component provided in their docs along with client:only="react"

Also, check out the Stackblitz sample for more info.

Hope it helped 😄

Edit: added @SOG-web

@ascorbic
Copy link
Contributor

Thanks for the pointer @darpserj. I do have a workaround, but it doesn't need all of the things you've suggested (most of which are Next.js-specific). The things you do need are:

  • a wrapper component
  • define IS_PREACT (yes really, even with React)

The working example is here: https://stackblitz.com/edit/github-ukl5k9ba?file=astro.config.mjs

The fact the Preact thing is needed is clearly a bug in Excalidraw, so I'd suggest reporting it to them. In the meantime, you can use that demo and a starting point.

@ascorbic ascorbic closed this as not planned Won't fix, can't repro, duplicate, stale Jan 10, 2025
@SOG-web
Copy link
Author

SOG-web commented Jan 10, 2025

Thanks for the pointer @darpserj. I do have a workaround, but it doesn't need all of the things you've suggested (most of which are Next.js-specific). The things you do need are:

* a wrapper component

* define IS_PREACT (yes really, even with React)

The working example is here: https://stackblitz.com/edit/github-ukl5k9ba?file=astro.config.mjs

The fact the Preact thing is needed is clearly a bug in Excalidraw, so I'd suggest reporting it to them. In the meantime, you can use that demo and a starting point.

thanks so much

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage Issue needs to be triaged pkg: react Related to React (scope)
Projects
None yet
Development

No branches or pull requests

5 participants