Skip to content

fix: create ParticipantSelect's debounced loader before mount - #10

Merged
helldweller merged 1 commit into
mainfrom
fix/participant-select-debounce
Oct 26, 2026
Merged

helldweller merged 1 commit into
mainfrom
fix/participant-select-debounce

Conversation

@helldweller

Copy link
Copy Markdown
Owner

Bug

Opening any participant select (incident detail pane, handoff dialog, task owner, incident filter) logs TypeError: l is not a function from ParticipantSelect-*.js. Unminified: debouncedGetIndividualData is not a function.

v-autocomplete syncs its search model while it mounts, i.e. before the parent's onMounted hook, and the watch(search, …) callback calls the debounced loader, which until now was created only in onMounted. Introduced upstream in Netflix#3925.

Fix

Create debouncedGetIndividualData with debounce() in setup(); onMounted keeps the initial load. One-line move.

Test

src/tests/participantSelectSearchBeforeMount.spec.js mounts the component with a mocked individuals API, collects Vue errors and unhandled rejections, and asserts none escape and the API is queried after the debounce. Fails on main with exactly the production error, passes with the fix.

🤖 Generated with Claude Code

v-autocomplete syncs its search model while it mounts, which runs the
`search` watcher before the parent's onMounted hook. The debounced loader
was only created in onMounted, so the watcher called null and the console
showed "debouncedGetIndividualData is not a function" (minified: "l is not
a function") every time a participant select opened. Create the debounced
function in setup; onMounted keeps the initial load.

Regression test mounts the component and asserts no error escapes and the
individuals API is queried. Introduced upstream in Netflix#3925.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@helldweller helldweller added the bug Something isn't working label Oct 26, 2026
@helldweller
helldweller requested a balanced review from Copilot October 26, 2026 03:52

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

The change is a minimal, correct relocation of the debounce creation that resolves the documented error and is covered by a regression test following established repo patterns.

No open issues 🎉

What changed in this PR

This PR fixes a runtime TypeError (debouncedGetIndividualData is not a function) that occurred whenever a ParticipantSelect was opened. The root cause is that Vuetify's v-autocomplete syncs its search model during mount—before the parent's onMounted hook—so the watch(search, …) callback invoked the debounced loader while it was still null. The fix creates the debounced loader in setup() so it exists before any watcher fires, keeping the component's search-as-you-type behavior intact.

Changes:

  • Move debouncedGetIndividualData = debounce(getIndividualData, 300) from onMounted into the setup() body (now a const), with onMounted retaining only the initial load.
  • Add a regression test that mounts the component with a mocked individuals API, captures Vue errors / unhandled rejections, and asserts none escape while the API is still queried after the debounce.
File Description
src/​dispatch/​static/​dispatch/​src/​components/​ParticipantSelect.vue Creates the debounced loader in setup() before mount so the search watcher can safely call it.
src/​dispatch/​static/​dispatch/​src/​tests/​participantSelectSearchBeforeMount.spec.js New test reproducing the pre-mount search error and verifying the fix.

Review effort: Balanced

@helldweller
helldweller merged commit 6953807 into main Oct 26, 2026
9 of 10 checks passed
@helldweller
helldweller deleted the fix/participant-select-debounce branch October 26, 2026 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants