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

Bug: Concurrently editing and deleting idea results in Ecto.NoResultsError #528

Open
JannikStreek opened this issue Dec 23, 2024 · 3 comments
Labels
type-bug Something isn't working

Comments

@JannikStreek
Copy link
Member

Further Notes

When opening the edit modal and another user deletes the same idea, an error (Ecto.NoResultsError) is thrown. Error handling is missing in this case.

lib/mindwendel_web/live/brainstorming_live/show.ex:151

 socket
    |> assign(:idea, Ideas.get_idea!(idea_id)
@JannikStreek JannikStreek added the type-bug Something isn't working label Dec 23, 2024
@JannikStreek JannikStreek changed the title Bug: Concurrently editing and deleting idea result in Ecto.NoResultsError Bug: Concurrently editing and deleting idea results in Ecto.NoResultsError Dec 23, 2024
@PragTob
Copy link
Collaborator

PragTob commented Dec 23, 2024

I think that's very fair and a fun scenario. I think the question here is only how it will be presented to the user. I'd avoid writing a lot of custom code and custom checks for this as there will potentially tons of cases for issues like this (somebody comments on an idea that someone else deletes, someone moves an idea someone else is deleting... etc.). So, I think that the best way is to display a fitting error message to the user when this exceptional case occurs :)

@JannikStreek
Copy link
Member Author

I think that's very fair and a fun scenario. I think the question here is only how it will be presented to the user. I'd avoid writing a lot of custom code and custom checks for this as there will potentially tons of cases for issues like this (somebody comments on an idea that someone else deletes, someone moves an idea someone else is deleting... etc.). So, I think that the best way is to display a fitting error message to the user when this exceptional case occurs :)

Well, I might have used not the correct words. I am more referring to an easier case: one user opens the edit modal of an idea, types something and at the same time the other user deletes the idea. So this is not a very rare case, can definitely happen as you have like 10+ seconds to reach the scenario. And it results in the error shown above. We do not need fancy error handling but at least closing the modal and showing a flash error would be good. You are right that there are more scenarios where this can happen!

@PragTob
Copy link
Collaborator

PragTob commented Dec 23, 2024

yeah it's definitely common but what I meant to say/do was just that: Display an error like "oops something went wrong with that idea" and at best close the overlay.

Just wanted to say, that if you try to accommodate for each of those on an individual basis it might get really hard. I mean it may be needed esp. in a class room context like "oh someone deleted this sorry". Thinking about it, potentially you'd want to give the user to even restore the idea someone else had deleted - but that gets even harder. One could even "lock" ideas from deletion for a certain time after interaction but that also gets difficult.... fun problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants