Skip to content

emrg: fix GUI task form empty dropdowns on quick add (rant 2026-08-14T15:41:52) - #789

Merged
argszero merged 1 commit into
masterfrom
feature/gui-task-form-race-fix
Aug 14, 2026
Merged

emrg: fix GUI task form empty dropdowns on quick add (rant 2026-08-14T15:41:52)#789
argszero merged 1 commit into
masterfrom
feature/gui-task-form-race-fix

Conversation

@argszero

Copy link
Copy Markdown
Owner

Host reported (rant 2026-08-14T15:41:52): in task management, clicking "+ Add Task" then "Save Task" appears to do nothing.

Root cause (reproduced in headless Chrome against the real v0.2.36 renderer):
Race between openTaskForm and loadTaskMeta. The sidebar ⏱ nav handler calls openTasksPanel() fire-and-forget; openTaskForm synchronously reads the taskTypes/taskProjects globals while the taskTemplateList/listProjects IPC is still in flight → both dropdowns render 0 options → type/project are empty on save → main.js validation throws "invalid task type" → the error only lands in the chat area, so the UI looks unresponsive.

Fix (emrg/gui/renderer/js/dialogs.js):

  • openTaskForm is now async and awaits loadTaskMeta() when the metadata globals are still empty (idempotent fast path: if the panel already loaded metadata, the form fills synchronously with no flicker; if not, it waits for the IPC before populating the dropdowns).
  • Call sites (edit button, add button) wrap the fire-and-forget promise with .catch(() => {}) for safety.

Test (emrg/gui/test/renderer.smoke.test.js):

  • New regression test with 50ms-delayed taskTemplateList/listProjects mocks: open the panel, immediately click "+ Add Task", assert both dropdowns end up populated and a quick save submits a taskCreate payload with non-empty type/project.

Verification: GUI 245 → 246 all green (new test passes; existing P3 task-form tests unchanged), node --check clean, pytest 805 unchanged (doc-count guard synced in Agent.md).

@argszero argszero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle

@argszero argszero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle

@argszero argszero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle

@argszero
argszero merged commit 4f0d69f into master Aug 14, 2026
2 checks passed

@argszero argszero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant