fix: Empty screen for signed user#154
Conversation
Ensure configuration fetch is finished before trying to use it. Signed-off-by: HornedHeck <43969792+HornedHeck@users.noreply.github.com>
Signed-off-by: HornedHeck <43969792+HornedHeck@users.noreply.github.com>
|
ACK 👍 |
|
I am unable to replicate the issue. Please open a git issue with more details. It seems to me that you may have your self-hosted environment misconfigured. |
Co-authored-by: Taureon <45183108+Taureon@users.noreply.github.com> Signed-off-by: HornedHeck <43969792+HornedHeck@users.noreply.github.com>
Also the current code seems somewhat strange for me. For guest users (or bots) client awaits for configuration fetch in |
That PR didn't actually do anything, the invite only issue was already fixed, and I've closed it.
The configuration is fetched during client initialization, so fetchConfiguration doesn't need to be called anywhere anymore. I just didn't remove the older calls. You are right that it's possible that the configuration is not fetched by time The self-hosted repo generates a .env.web file that has all of the vite variables automatically filled out. If you're trying to connect a developing verison of the for-web repo, you must copy the variables in .env.web to the .env file in the for-web repo. Edit: If there's anything to change about this, it would be to make |
1. Configuration Fetch
2. Web-client configuration correctness
Correct me if I am wrong, but the following snippet (from web client): DEFAULT_WS_URL:
(import.meta.env.DEV ? import.meta.env.VITE_DEV_WS_URL : undefined) ??
(import.meta.env.VITE_WS_URL as string) ??
"wss://stoat.chat/events",should return default stoat web socket url ("wss://stoat.chat/events"). But for me it was "", despite env var was set to non-empty value. 3. SummaryTBH, I do not want to argue, whether my config is correct or not (it may be incorrect). There are still configuration options that are part of code, but are not controlled by env variables. All of them can have different values in server-side configuration compared to client side (now and in future). Right now the code contains a race condition in form of what would happen first: |
BUG
When I try to open stoat-for-web for self-hosted instance for already signed in user, I see empty screen.
REASON
Client.ts tries to connect to WebSocket by the url specified in the configuration. However it does not await for results of configuration sync in constructor. It leads to the fact that
configuration.wsis empty and is not value WebSocket url.STEPS:
EXPECTED
Signed-in experience is visible and accessible.