WebUI sends duplicate DELETE /message/{id} when leaving the page with pending deletes
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 80/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- javascript, typescript
- Domain
- frontend
Research direction
Start in reactions.ts, where executePendingDeletes is registered for both pagehide and beforeunload, then read MessagesStore.removeSingle, which checks pendingDeletes but only clears the entry after the axios DELETE returns. Reproduce by deleting messages in the web UI, closing the tab while the undo snackbar is open, and watching the network log for duplicate DELETE requests. Done when each message gets exactly one DELETE request when the page is left.
Written by the indexing model from the issue text.
Description
I stumbled across some 404 in the docker logs and asked my artifical friend to dig deeper into this. He drills it down to some js code in the web frontend. If that is okay with you maybe you'll take a look at it - thanks 😅
Can the issue be reproduced with the latest available release? (y/n)
y (v3.1.1)
Which one is the environment gotify server is running in?
- Docker
- Linux machine
- Windows machine
Docker startup command or config file here (please mask sensitive information)
image: gotify/server:latest # 3.1.1, commit e6361ca
Do you have an reverse proxy installed in front of gotify server? (Please select None if the problem can be reproduced without the presense of a reverse proxy)
- None
- Nginx
- Apache
- Caddy
- Traefik (not relevant, the duplicate requests originate in the WebUI)
On which client do you experience problems? (Select as many as you can see)
- WebUI
- gotify-cli
- Android Client
- 3rd-party API call
What did you do?
Deleted messages in the WebUI and left/closed the tab while the undo snackbar was still open.
What did you expect to see?
One DELETE /message/{id} per message.
What did you see instead?
Two DELETE /message/{id} per message in the same second; the second one usually fails:
INF HTTP method=DELETE path=/message/150242 status=200
WRN HTTP errors="Error #01: message does not exist" method=DELETE path=/message/150242 status=404
Cause: reactions.ts registers executePendingDeletes for both pagehide and beforeunload, which usually both fire when leaving the page. MessagesStore.removeSingle checks pendingDeletes.has(id) but only removes the entry (cancelPendingDelete) after await axios.delete(...) returns, so the second call passes the check and sends another DELETE.
Possible fix: remove the entry from pendingDeletes before sending the request (or guard executePendingDeletes so it runs only once).
- Dominant language
- Go
- Stars
- 16k
- Forks
- 891
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 6
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from gotify/server
-
Session elevation duration is unbounded, and large values silently overflow to a past timestampPossibly taken @piyush295 claimed this 13 days ago. Opena:bug
Difficulty 3/5 1-2 days Newbie friendliness 78/100
gotify/server#1051 · 2 comments ·
Maintainers usually reply within 2 days
-
a:bug
Difficulty 4/5 3-5 days Newbie friendliness 48/100
gotify/server#1047 · 6 comments ·
Maintainers usually reply within 2 days
-
a:feature
Difficulty 5/5 Over a week Newbie friendliness 35/100
Maintainers usually reply within 2 days
-
a:feature
Difficulty 4/5 3-5 days Newbie friendliness 35/100
Maintainers usually reply within 2 days
-
a:feature
Difficulty 5/5 Over a week Newbie friendliness 30/100
Maintainers usually reply within 2 days
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
AvengeMedia/DankMaterialShell#3761 ·
Maintainers usually reply within 1 day
-
docs: clarify replacement for outdated Terms of Service URL in readme.mdPossibly taken @mohitjoshi-hey claimed this today. Open
Difficulty 1/5 1-3 hours Newbie friendliness 66/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
SocialGouv/iterion#2320 ·
Maintainers usually reply within 1 day
-
helm chart: the first upgrade after install restarts the filer and S3 gateway although nothing changedPossibly taken @egezamb claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
[mesheryctl] Potential runtime panic (index out of range) in system status when pod container statuses are partially populatedPossibly taken @Ayush-AM claimed this today. Opencomponent/mesheryctl kind/bug language/go
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
meshery/meshery#22312 · 2 comments ·
Maintainers usually reply within 1 day