Skip to content

fix(admin): fix customers api endpoint to respect new cells architecture#107927

Merged
markstory merged 2 commits intomasterfrom
shellmayr/fix/admin-fix-customers-cell-api-endpoint
Feb 10, 2026
Merged

fix(admin): fix customers api endpoint to respect new cells architecture#107927
markstory merged 2 commits intomasterfrom
shellmayr/fix/admin-fix-customers-cell-api-endpoint

Conversation

@shellmayr
Copy link
Member

@shellmayr shellmayr commented Feb 10, 2026

  • With the new cells architecture, API URLs have changed - some of the APIs that _admin calls therefore 404, breaking some of the admin flows
  • This PR fixes the problem by routing debounced searches to the respective cells if applicable

Before:
image

Afterwards: shows a dropdown with orgs - omitted the image for obvious reasons

@shellmayr shellmayr marked this pull request as ready for review February 10, 2026 13:32
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Feb 10, 2026
@shellmayr shellmayr requested a review from a team February 10, 2026 13:34
Copy link
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

Comment on lines 61 to 67
query: [queryParam, value].filter(v => v).join(':'),
per_page: 10,
};
const results = await api.requestPromise(path, {
const results = await api.requestPromise(searchPath, {
method: 'GET',
host: searchHost,
data: queryParams,
Copy link
Contributor

Choose a reason for hiding this comment

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

Bug: Changing the region while a debounced search is pending causes the API request to be sent to the old, incorrect endpoint.
Severity: MEDIUM

Suggested Fix

Cancel the pending debounced function when the path prop changes. This can be achieved by calling the .cancel() method on the debounced function within a useEffect hook that has path in its dependency array. Alternatively, recreate the debounced function using useMemo with path as a dependency instead of useRef.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: static/gsAdmin/components/debounceSearch.tsx#L61-L67

Potential issue: A race condition exists in the `DebounceSearch` component. The
`debouncedSearch` function is created once via `useRef` and does not reset when its
`path` prop changes. If a user types in the search input and then changes the region
within the 300ms debounce delay, the search will execute with the original `path`. This
sends the API request to the incorrect regional endpoint, potentially returning results
from the wrong region or a 404 error. This behavior is introduced by this pull request,
which makes the search path dynamic.

Did we get this right? 👍 / 👎 to inform future reviews.

@markstory markstory merged commit b656ab4 into master Feb 10, 2026
59 checks passed
@markstory markstory deleted the shellmayr/fix/admin-fix-customers-cell-api-endpoint branch February 10, 2026 14:55
jaydgoss pushed a commit that referenced this pull request Feb 12, 2026
…ure (#107927)

- With the new cells architecture, API URLs have changed - some of the
APIs that _admin calls therefore 404, breaking some of the admin flows
- This PR fixes the problem by routing debounced searches to the
respective cells if applicable

Before:
<img width="299" height="231" alt="image"
src="https://github.com/user-attachments/assets/c142ff5b-47d8-497c-8784-8dcb0eab477f"
/>


Afterwards: shows a dropdown with orgs - omitted the image for obvious
reasons
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants