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
Remix example #443
Remix example #443
Conversation
@lfleischmann Could you please review this? |
Hi @IgnisDa, Yes, finally found time to get my eyes on this, sorry for the delay. And: thanks for taking the time to contribute the example! Currently, I'm having problems with running the example in our compose cluster (I use the command you added to the "examples" directory readme). After a successful registration I get an error when loading the todo route:
This does not happen in a non-docker context but I am not entirely sure why right now. I am also having trouble to properly debug the remix application inside a container (any tips?). I also noticed the remix application (remix dev server?) continuously makes websocket requests to the express app at port 8002 in the compose context. This also does not happen when running the services/applications in a non-docker context. Any idea why this happens? |
@lfleischmann I made some changes to the container. Now the running app uses the build output rather than the default remix dev server. So no WS connections are made any more. |
@lfleischmann Could you please take a look? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @IgnisDa,
again, sorry for the delay, only just now getting back in the game after the holidays...
App runs fine now in the compose context, thanks. Just noticed one other thing: sometimes the web component does not properly render in its entirety/styles are not applied properly (see screenshot below for an example from Safari) and I have to reload to get a proper rerender. I can't reliably reproduce this though, sometimes it happens, sometimes it does not. So far seen in Chrome, Edge and Safari. I also checked whether this
is influenced by the shadow DOM usage (i.e. the shadow
option on component registration) but it happens both with and without shadow DOM. Do you have any ideas why this is happening/how to fix this?
I am not sure about the CSS thing, but I have encountered it too. I think it is related to remix-run/remix#2570 but can not be sure. It does not happen in incognito windows (i.e. when browser extensions are disabled). I have not been able to reproduce it reliably enough to be actually fix it. |
Alright, thanks. We would like to investigate a bit further to find out what exactly causes the issue and how we can solve it to ensure the component is always rendered properly. It does not have top priority right now though, so I can't say how soon we are gonna tackle this. |
Okay makes sense. Will this PR be merged till then? |
Hey, |
@like-a-bause @lfleischmann I updated the remix packages, and I did not encounter the above bug anymore. Could you give it another spin and see if the problem persists? |
@IgnisDa OK, after updating |
@IgnisDa the error apparently is happening in
I'll try to debug further. |
@cayblood Can you share your |
@IgnisDa Here is my
|
Here is mine REMIX_APP_HANKO_API=http://localhost:8000
REMIX_APP_TODO_API=http://localhost:8002 |
@IgnisDa Right. I had to change |
@IgnisDa By the way, I'm also getting intermittent CSS errors. Sometimes I see: And other times I see: I can keep refreshing and randomly see one of those two results. |
Yep this is the reason why this PR has not been merged yet. Do you have the latest commit checked out? |
@IgnisDa Looks like a change just came in today. I was testing this last night. I've updated to the latest. I did finally get it to work, but by ignoring the instructions in the README. Rather than running |
Yep the |
@IgnisDa I would recommend updating the README inside the remix folder so that it accurately explains how to start and access the app. |
@IgnisDa looks like when remix-run/remix#4175 gets resolved the CSS problem will probably go away. Update: that issue links to this one: facebook/react#24430. Seems like it is a problem with React 18 that has been experienced in other frameworks besides just Remix. Doesn't look like that is a high priority for the React team, based on how long the issue has been reported without a response. Might be worth pursuing a workaround if possible. |
@cayblood Thanks, I updated the instructions.
I am aware of these issues, but have not been able to find any workarounds yet. |
@IgnisDa I found a potential workaround described here. Looking into it. |
@IgnisDa I submitted a PR to your fork with an easy workaround that falls back to React 17 functionality. I'll let you know if I come up with something better. |
@lfleischmann @like-a-bause With @cayblood's help, we got the example fully working. I think it can be merged now. |
// `.client.ts` files are only supposed to run on the client. I could not find this | ||
// documented on the remix docs but someone on the remix discord told me this is how it is | ||
// supposed to work. | ||
import { register } from '@teamhanko/hanko-elements'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this, the remix build command currently results in: "ERROR: Could not resolve "@teamhanko/hanko-elements"
Reverting to @teamhanko/hanko-elements@0.0.17-alpha
requires the "old" import path for the register function, i.e. import { register } from '@teamhanko/hanko-elements/hanko-auth'
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@IgnisDa I just submitted a PR for this fix plus another compatibility issue I found with the ClientOnly component.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@IgnisDa @lfleischmann replied below before my fix was merged into this PR. I think their concerns would go away and we could finally get this merged with that fix. That said, we should probably update to 0.5.0, now that it has been released.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added you as a collaborator in my repository in case you need to make any changes.
Hi @IgnisDa, @cayblood, once again: thank your for your time and effort! Unfortunately, we're still seeing the problem with unapplied styles in Safari, so we're holding off the merge for now until we're sure the example works across browsers. |
As discussed in #429, here is a functioning example for the remix framework. It features server side authentication and works with javascript disabled (except the login route of course).