Error in dev mode with LitElements #6200
Unanswered
alexandre-lelain
asked this question in
Q&A
Replies: 2 comments
-
Same problem here! |
Beta Was this translation helpful? Give feedback.
0 replies
-
For anyone having the same issue, you can use remix-utils' ClientOnly component to render your LitElement on client side only to avoid the error in development mode. You will need to rename the file of MyLitElement from // app/routes/index.tsx
import { ClientOnly } from "remix-utils";
import { MyLitElement } from "../components/MyLitElement.client.tsx"
<ClientSide>
{() => <MyLitElement />}
</ClientSide> However this is just a temporary workaround, because it prevents us to use LitElements in SSR. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
What version of Remix are you using?
1.14.3
Are all your remix dependencies & dev-dependencies using the same version?
Steps to Reproduce
Hello,
First of all, thank you for this awesome project that is Remix run.
I'm trying to use LitElements in my Remix application. Since Remix uses React, I'm using Lit's React wrapper to be able to use LitElements in my views.
At first, it looks like it works like a charm : I run the dev server, visit my browser, and see my LitElement displayed on the screen. However as soon as I refresh the page or make a change in the code, the application crashes with the following error :
The error stays there until I stop the dev server, and run it again. The error appears again after a page refresh or a code change. And so on. This error seems very similar to this issue in a different project : WICG/webcomponents#754 (comment).
I feel like Remix is not cleaning the
CustomElementRegistry
cache in dev mode, and sinceCustomElements
can only be defined once, it produces the error I mentioned above when the page is hot-reloaded.I made a git project to reproduce the error : https://github.com/alexandre-lelain/remix-lit-elements
Expected Behavior
My application should not crash after a page reload in dev mode when using LitElements.
Actual Behavior
My application is crashing after a page reload in dev mode when using LitElements.
Beta Was this translation helpful? Give feedback.
All reactions