Skip to content

Conversation

@B4nan
Copy link
Member

@B4nan B4nan commented Aug 4, 2025

Also opens the kapa widget with the AI chat tab first.

Closes #1745

also opens the kapa widget with the AI chat tab first
@B4nan B4nan added the adhoc Ad-hoc unplanned task added during the sprint. label Aug 4, 2025
@github-actions github-actions bot added this to the 120th sprint - Tooling team milestone Aug 4, 2025
@github-actions github-actions bot added the t-tooling Issues with this label are in the ownership of the tooling team. label Aug 4, 2025
@B4nan B4nan requested a review from TC-MO August 4, 2025 14:56
@apify-service-account
Copy link

Preview for this PR was built for commit b48a83b and is ready at https://pr-1755.preview.docs.apify.com!

Copy link
Contributor

@TC-MO TC-MO left a comment

Choose a reason for hiding this comment

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

LGTM, tested both windows & mac

Copy link

@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.

Bug: Search Modal Stuck Open on Widget Failures

The opened state, which prevents re-opening the search modal, is incorrectly left as true if the modal fails to open. This occurs when the Kapa or Inkeep widgets are unavailable, or an unknown search variant is encountered, as the onClick handler exits without resetting the state. Consequently, the search modal cannot be opened again until a page refresh.

apify-docs-theme/src/theme/SearchBar/index.js#L200-L203

modal.update({ modalSettings: { isOpen: true } });
} else {
console.error('Inkeep widget is not available.');
}

apify-docs-theme/src/theme/SearchBar/index.js#L119-L123

if (variant !== 'inkeep') {
console.warn('Unknown search variant:', variant);
return;
}

Fix in Cursor Fix in Web

Comment bugbot run to trigger another review on this PR


function handleOpenChange(newOpen) {
modal.update({ modalSettings: { isOpen: newOpen } });
setOpened(newOpen);
Copy link

Choose a reason for hiding this comment

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

Bug: SearchBar Prop Ignored, State Not Reset

The SearchBar component reassigns its onClick prop, effectively ignoring any onClick handler passed from parent components. Additionally, the opened state, which prevents multiple modal openings, is not reset to false if the Kapa or Inkeep search widgets fail to open. This leaves the search bar permanently unresponsive until the page is refreshed.

Fix in Cursor Fix in Web

window.Kapa.open();
window.Kapa('onModalClose', () => {
setOpened(false);
});
Copy link

Choose a reason for hiding this comment

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

Bug: Kapa.ai Integration Causes Search Bar Issues

The search bar component exhibits two issues related to the Kapa.ai integration:

  1. Opening the Kapa modal repeatedly registers new onModalClose event listeners, leading to multiple setOpened(false) calls and potential memory leaks when the modal closes.
  2. If the Kapa.ai widget is unavailable, the opened state is set to true but never reset to false, permanently preventing any subsequent attempts to open the search modal.
Fix in Cursor Fix in Web

@B4nan B4nan merged commit 42283fa into master Aug 4, 2025
10 checks passed
@B4nan B4nan deleted the cmd-k-search-modal branch August 4, 2025 15:04
daveomri pushed a commit to daveomri/apify-docs that referenced this pull request Sep 3, 2025
Also opens the kapa widget with the AI chat tab first.

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

Labels

adhoc Ad-hoc unplanned task added during the sprint. t-tooling Issues with this label are in the ownership of the tooling team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Search by CMD+K does not work in apify doc

4 participants