Files
kandev/apps/web/components
João Salavisa fbe2410fdb feat(web): hide Jira buttons when disabled or auth failing (#725)
* feat(web): hide Jira buttons when disabled or auth failing

Hide the Jira import button on the task creation dialog and the "Link Jira" button on the task top bar when the workspace toggle is off, no Jira config exists, or the most recent backend auth probe failed. Centralizes the gating logic in a shared useJiraAvailable hook.

* fix(web): address PR review feedback on Jira availability gate

- Gate the auth probe on `loaded` from useJiraEnabled so it never fires when the toggle starts disabled
- Reset cached auth on workspace change so the previous workspace's `true` can't briefly leak into the new one
- JiraTopbarButton now consumes the shared useJiraAvailable hook instead of replicating the two-step gate inline

* fix(web): apply prettier formatting to use-jira-availability.ts

* fix(web): tag Jira auth state with workspaceId to avoid poll-tick flicker

Storing `{workspaceId, authed}` together and filtering at read time invalidates stale auth synchronously when the workspace switches, removing the need for a setAuthed(false) reset that was previously firing on every 90s poll tick. Adds a fake-timer test that asserts no false render slips through across a poll tick while auth stays healthy.

---------

Co-authored-by: Kandev Agent <agent@kandev.dev>
2026-04-28 11:50:30 +01:00
..
2026-02-19 22:18:01 +00:00