fix: prevent duplicate session action requests causing 404s

- Add early return guards in all session action handlers (start, stop, delete, recreate tunnel)
- Prevents race conditions where double-clicks or rapid clicks fire duplicate API calls
- First delete succeeds, second would 404 because instance is already deleted
- Applied to both sessions page and dashboard/home page
This commit is contained in:
2026-05-24 19:40:42 +00:00
parent 9320e175d1
commit deb22bec0f
2 changed files with 9 additions and 0 deletions
+4
View File
@@ -143,6 +143,7 @@ export const HomePage = () => {
};
const handleStop = async (session: SessionView) => {
if (actionBusy === session.id) return;
setActionBusy(session.id);
try {
await stopInstance(session.project_id, session.repository_id, session.id);
@@ -153,6 +154,7 @@ export const HomePage = () => {
};
const handleDelete = async (session: SessionView) => {
if (actionBusy === session.id) return;
setActionBusy(session.id);
try {
await deleteInstance(session.project_id, session.repository_id, session.id);
@@ -165,6 +167,7 @@ export const HomePage = () => {
};
const handleRecreateTunnel = async (session: SessionView) => {
if (actionBusy === session.id) return;
setActionBusy(session.id);
try {
await recreateInstanceTunnel(session.project_id, session.repository_id, session.id);
@@ -175,6 +178,7 @@ export const HomePage = () => {
};
const handleStart = async (session: SessionView) => {
if (actionBusy === session.id) return;
setActionBusy(session.id);
try {
await startInstance(session.project_id, session.repository_id, session.id);