lemmy-ui
lemmy-ui copied to clipboard
Posting with language_not_allowed error leads to broken form state (not resubmittable)
When trying to post a comment with a disallowed language selected (in my case I have undetermined (default), EN and DE as options) a language_not_allowed
error (no text description of this error key shown) is shown (bottom left popin). The Post button becomes a non-interactable spinner. The comment can not be resubmitted after setting a/the correct language.
Workaround: Copy comment text, refresh page, paste comment text, select language, and Post again.
(Occurred multiple times for me, on various posts, on the feddit.de instance.)
Related but seems to describe a different issue: #919, possibly reduced impact with/after open PR #1008
I tested this out with the most up to date changes on the main branch and the only selectable languages were an intersection of the languages allowed on the instance and the languages the user selected, e.g. if a site allows undetermined, English, and German and a user who has undetermined, English, and Spanish as their selected languages, they will only be able to post a comment labeled undetermined or English. However, this was with a user on the same instance. I'm not sure if this is still a problem when trying to post to a federated instance.
When you were encountering this problem, were you posting on your home instance or a federated instance?
When I comment to beehaw [1] it works with undetermined. When I post on my home instance [2] it fails as described.
- [1]: https://feddit.de/post/690452 beehaw
- [2]: https://feddit.de/post/687880 feddit
edit: Correction
I did a bit of testing to try to get to the root of the problem. First, I ran the docker images of the 0.17.2 version of the frontend and backend (the versions currently used by feddit.de judging by the site footer). I made it so that not all languages were available to use on the instance. I noticed that when I tried to create a community, unless the instance supports all the available languages, there would always one language in the community's list of selectable languages that wasn't allowed by the instance. This made it possible for communities to be created that list languages that aren't supposed to be on the instance.
After this, I used the dev docker image for the backend and the main branch for the frontend. This time, I was unable to create a community with a language that isn't available on the instance. I'm not sure if communities picking languages not available on the instance is what caused the issue you encountered, but it was the closest I could get to reproducing your issue.
I don't know what else I can do to help with this issue for the moment: it could be worth putting this issue on the back burner for the time being and revisiting it whenever the most recently lemmy changes get released and used by your instance. Once that's done, you could see if doing the same set of steps still reproduces the problem.
My main issue is that a displayed error message (I don't care that it's not translated/prose) leads to a non-interactable broken form.
If the form sends a request, receives and shows an error, it should revert to the pre-submission state and allow me to adjust input and resend.
I'm not sure I follow your (backend) analysis, but my focus was on the UI form interaction breaking - which is why I posted it here in the UI repo.
I'm not sure I follow your (backend) analysis, but my focus was on the UI form interaction breaking - which is why I posted it here in the UI repo.
I was able to get the app in the state you described in the most recent release version of the app, but not with the latest unreleased code on the main branch. This leads me to think that the issue may already be fixed, but not in a version of the software any instances are using yet. Because of this, I'm not sure if there are any further code changes needed. I'll try to reproduce your issue again when I get the chance, although as I said in a previous comment the UI didn't even give me the option to pick an unsupported language, making it impossible to end up in the state that caused your error in the first place.
Really all we need to do is set loading = false on an API error, which we should do on all routes anyway. Then you would be able to change the language and resubmit.
However, this was with a user on the same instance. I'm not sure if this is still a problem when trying to post to a federated instance.
In general there is no difference for the frontend when posting to a federated instance. Federated actions are done asynchronously on the backend. If that fails, it will still look like a success on the frontend and you have to visit the other instance to notice that it didnt go through.
The issue is still occurring for me on an instance running version 0.17.2-kt.1. It seems to occur when replying to a thread from a federated instance.
This is still occurring. I noticed it when trying to post to [email protected]
, and it "hung" making it look like I had instance communication issues. Digging into the actual container logs, we see it was rejected because language_not_allowed
that the UI didn't catch and process:
LemmyError { message: Some("language_not_allowed"), inner: language_not_allowed, context: SpanTrace [{ target: "lemmy_api_crud::comment::create", name: "perform", fields: "self=CreateComment { content: \"That's it lads! Rock and stone!\" ... }
It should cancel the post, notify the user of the error, and allow them to "fix" it.
I had this problem on lemmy.world today (using Lemmy 0.18.5) when I selected "English" as my language. Switching it back to "Undetermined" allowed me to post.
It's still a problem on v0.19.3.