jira/apps/web/core/hooks
sriram veeraghanta 7564480cf7
fix: resolve React Doctor errors and restore its PR baseline (#9488)
* fix: resolve React Doctor errors and restore its PR baseline

The React Doctor check on PR #9160 reported 266 issues across 130 files.
Most of that is a reporting artifact: the workflow's `actions/checkout`
step used the default shallow clone, so React Doctor had no merge base to
diff against and fell back to listing every pre-existing issue in every
changed file rather than only what the PR introduced. Add `fetch-depth: 0`
so the comparison works. Also point the `push` trigger at `preview` — the
repo's default branch — instead of `main`, which does not exist here, so
the health-score trend never ran.

Fix the 7 genuine errors it surfaced:

- use-keypress: `callback` sat in the effect deps while every one of the
  10 call sites passes an inline arrow, so the document listener was torn
  down and re-added on every render. Latch the callback in a ref and key
  the subscription on `key` alone. This clears `no-effect-with-fresh-deps`
  at create-root.tsx:102 and create-project-modal.tsx:64 at the source.

- estimates/points/preview: the dblclick listener was added with no
  cleanup, so listeners accumulated on every toggle. Add the matching
  removeEventListener.

- issues/header, calendar/issue-block, pages/editor/editor-body: guard
  `window` reads that run during render with `typeof window !== "undefined"`,
  matching the pattern already used elsewhere in web and admin. The editor
  case previously relied on the surrounding try/catch swallowing a
  ReferenceError on the server.

Also clears the five pre-existing oxlint warnings in calendar/issue-block
that the repo's `--deny-warnings` pre-commit gate blocks on once the file
is touched: rename a shadowed `issue` parameter, and mark two presentational
wrapper divs with `role="presentation"` — CustomMenu already wraps the
first in a real <button>, and the second exists only to stop click
propagation to the surrounding ControlLink.

Verified: `turbo run check:types --filter=web` passes (11/11 tasks),
`oxlint --deny-warnings` reports 0 warnings and 0 errors on the changed files.

Claude-Session: https://claude.ai/code/session_01Hrr1nfNBiyC256drHM8BbT

* fix: import EditorAIMenu directly instead of through the ai barrel

The only issue React Doctor reports against this branch. `./ai` re-exports
both menu.tsx and ask-pi-menu.tsx, so importing through it pulls the
ask-pi menu into the page editor bundle for a symbol that lives in
menu.tsx. Pre-existing on preview rather than introduced here, but it is
a one-line fix in a file this branch already touches.

Claude-Session: https://claude.ai/code/session_01Hrr1nfNBiyC256drHM8BbT

* fix: address CodeRabbit review on the React Doctor branch

- react-doctor.yml: set persist-credentials: false on checkout. The token
  otherwise stays in .git/config for the third-party millionco/react-doctor
  step that runs next. fetch-depth: 0 has already fetched every ref the
  merge-base diff needs, and the action authenticates to the API through
  its own credentials, so nothing depends on the persisted git credential.

- calendar/issue-block: pass workspaceSlug?.toString() to handleRedirection.
  The param is typed string | undefined and line 89 of the same file already
  optional-chains it; this call site would have thrown on a missing route
  param. Pre-existing, but it is on a line this branch already touches.

Declined the two SSR/hydration findings: apps/web sets ssr: false in
react-router.config.ts and ships a client-only bundle, so there is no
server render to diverge from. The typeof window guards satisfy the
React Doctor rule but are defensive only.

Claude-Session: https://claude.ai/code/session_01Hrr1nfNBiyC256drHM8BbT
2026-07-30 01:04:02 +05:30
..
context chore: add copyright (#8584) 2026-01-27 13:54:22 +05:30
editor [GIT-239 | GIT-240] refactor: hooks and constants consolidation to core (#9204) 2026-06-26 20:36:52 +05:30
oauth chore: add copyright (#8584) 2026-01-27 13:54:22 +05:30
pages [GIT-248 | GIT-254] refactor: store and components consolidation to core (#9245) 2026-07-16 13:13:04 +05:30
rich-filters [GIT-239 | GIT-240] refactor: hooks and constants consolidation to core (#9204) 2026-06-26 20:36:52 +05:30
store [GIT-248 | GIT-254] refactor: store and components consolidation to core (#9245) 2026-07-16 13:13:04 +05:30
work-item-filters [GIT-239 | GIT-240] refactor: hooks and constants consolidation to core (#9204) 2026-06-26 20:36:52 +05:30
use-additional-editor-mention.tsx [GIT-239 | GIT-240] refactor: hooks and constants consolidation to core (#9204) 2026-06-26 20:36:52 +05:30
use-additional-favorite-item-details.tsx [GIT-239 | GIT-240] refactor: hooks and constants consolidation to core (#9204) 2026-06-26 20:36:52 +05:30
use-app-router.tsx chore: add copyright (#8584) 2026-01-27 13:54:22 +05:30
use-auto-save.tsx chore: add copyright (#8584) 2026-01-27 13:54:22 +05:30
use-auto-scroller.tsx chore: add copyright (#8584) 2026-01-27 13:54:22 +05:30
use-bulk-operation-status.ts [GIT-239 | GIT-240] refactor: hooks and constants consolidation to core (#9204) 2026-06-26 20:36:52 +05:30
use-collaborative-page-actions.tsx fix: remove unused imports and variables (part 2 — web/core non-issues) (#8752) 2026-03-25 02:04:20 +05:30
use-current-time.tsx chore: add copyright (#8584) 2026-01-27 13:54:22 +05:30
use-debounce.tsx chore: add copyright (#8584) 2026-01-27 13:54:22 +05:30
use-debounced-duplicate-issues.tsx [GIT-239 | GIT-240] refactor: hooks and constants consolidation to core (#9204) 2026-06-26 20:36:52 +05:30
use-dropdown-key-down.tsx chore: add copyright (#8584) 2026-01-27 13:54:22 +05:30
use-dropdown.ts chore: add copyright (#8584) 2026-01-27 13:54:22 +05:30
use-editor-flagging.ts [GIT-239 | GIT-240] refactor: hooks and constants consolidation to core (#9204) 2026-06-26 20:36:52 +05:30
use-expandable-search.ts chore: add copyright (#8584) 2026-01-27 13:54:22 +05:30
use-extended-sidebar-overview-outside-click.tsx chore: add copyright (#8584) 2026-01-27 13:54:22 +05:30
use-favorite-item-details.tsx [GIT-239 | GIT-240] refactor: hooks and constants consolidation to core (#9204) 2026-06-26 20:36:52 +05:30
use-file-size.ts [GIT-239 | GIT-240] refactor: hooks and constants consolidation to core (#9204) 2026-06-26 20:36:52 +05:30
use-group-dragndrop.ts chore: add copyright (#8584) 2026-01-27 13:54:22 +05:30
use-integration-popup.tsx chore: add copyright (#8584) 2026-01-27 13:54:22 +05:30
use-intersection-observer.ts chore: add copyright (#8584) 2026-01-27 13:54:22 +05:30
use-issue-layout-store.ts chore: add copyright (#8584) 2026-01-27 13:54:22 +05:30
use-issue-peek-overview-redirection.tsx chore: add copyright (#8584) 2026-01-27 13:54:22 +05:30
use-issue-properties.tsx [GIT-239 | GIT-240] refactor: hooks and constants consolidation to core (#9204) 2026-06-26 20:36:52 +05:30
use-issues-actions.tsx chore: merge helpers and layouts (#8624) 2026-02-10 22:04:07 +05:30
use-keypress.tsx fix: resolve React Doctor errors and restore its PR baseline (#9488) 2026-07-30 01:04:02 +05:30
use-local-storage.tsx chore: add copyright (#8584) 2026-01-27 13:54:22 +05:30
use-multiple-select.ts chore: add copyright (#8584) 2026-01-27 13:54:22 +05:30
use-navigation-preferences.ts [GIT-238] refactor: migrate types from apps/web to @plane/types (#9203) 2026-06-09 18:06:08 +05:30
use-notification-preview.tsx [GIT-239 | GIT-240] refactor: hooks and constants consolidation to core (#9204) 2026-06-26 20:36:52 +05:30
use-online-status.ts chore: add copyright (#8584) 2026-01-27 13:54:22 +05:30
use-page-fallback.ts chore: add copyright (#8584) 2026-01-27 13:54:22 +05:30
use-page-filters.ts chore: add copyright (#8584) 2026-01-27 13:54:22 +05:30
use-page-flag.ts [GIT-239 | GIT-240] refactor: hooks and constants consolidation to core (#9204) 2026-06-26 20:36:52 +05:30
use-page-operations.ts chore: add copyright (#8584) 2026-01-27 13:54:22 +05:30
use-parse-editor-content.ts [GIT-239 | GIT-240] refactor: hooks and constants consolidation to core (#9204) 2026-06-26 20:36:52 +05:30
use-peek-overview-outside-click.tsx [WEB-6137] fix: work item peek view outside click #8610 2026-02-12 16:28:51 +05:30
use-platform-os.tsx chore: add copyright (#8584) 2026-01-27 13:54:22 +05:30
use-project-issue-properties.ts chore: add copyright (#8584) 2026-01-27 13:54:22 +05:30
use-query-params.ts chore: add copyright (#8584) 2026-01-27 13:54:22 +05:30
use-realtime-page-events.tsx [GIT-239 | GIT-240] refactor: hooks and constants consolidation to core (#9204) 2026-06-26 20:36:52 +05:30
use-reload-confirmation.tsx chore: add copyright (#8584) 2026-01-27 13:54:22 +05:30
use-stickies.tsx chore: add copyright (#8584) 2026-01-27 13:54:22 +05:30
use-table-keyboard-navigation.tsx chore: add copyright (#8584) 2026-01-27 13:54:22 +05:30
use-timeline-chart.ts [GIT-248 | GIT-254] refactor: store and components consolidation to core (#9245) 2026-07-16 13:13:04 +05:30
use-timer.tsx chore: add copyright (#8584) 2026-01-27 13:54:22 +05:30
use-timezone-converter.tsx chore: add copyright (#8584) 2026-01-27 13:54:22 +05:30
use-timezone.tsx chore: add copyright (#8584) 2026-01-27 13:54:22 +05:30
use-window-size.tsx chore: add copyright (#8584) 2026-01-27 13:54:22 +05:30
use-workspace-invitation.tsx chore: add copyright (#8584) 2026-01-27 13:54:22 +05:30
use-workspace-issue-properties-extended.tsx [GIT-239 | GIT-240] refactor: hooks and constants consolidation to core (#9204) 2026-06-26 20:36:52 +05:30
use-workspace-issue-properties.ts [GIT-239 | GIT-240] refactor: hooks and constants consolidation to core (#9204) 2026-06-26 20:36:52 +05:30
use-workspace-paths.ts chore: add copyright (#8584) 2026-01-27 13:54:22 +05:30