Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix infinite loading issue in Search Dialog #632

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
LooseLi wants to merge 1 commit into NotionX:master
base: master
Choose a base branch
Loading
from LooseLi:fix-search-dialog

Conversation

@LooseLi
Copy link
Contributor

@LooseLi LooseLi commented May 7, 2025
edited
Loading

Description

Fixes #593

When using the search functionality in react-notion-x, we identified a user experience issue: sometimes the loading icon continues to spin indefinitely when users enter content in the search dialog, even after the search request has successfully returned.

Solution

We resolved the infinite loading issue in the search dialog with the following improvements:

  1. replace throttle with debounce:
  • switched from throttle to debounce, which is more suitable for search scenarios
  • added the {trailing: true} option to ensure that a search is always executed after the user stops typing
  • this prevents multiple searches from being triggered when users type quickly, improving performance
  1. optimize query state management:
  • store the current query for later comparison
  • only update the UI state when the current query matches the query in the component state
  • prevent old search results from overwriting newer ones, solving state synchronization issues
  1. improve error handling:
  • add try-catch blocks to capture errors that may occur during the search process

Notion Test Page ID

I directly provided the searchNotion function in /NotionPage.tsx to NotionRenderer, enabling the search component to display and fixing related issues.

transitive-bullshit reacted with heart emoji
Copy link

vercel bot commented May 7, 2025
edited
Loading

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
react-notion-x ❌ Failed (Inspect) May 7, 2025 9:44am
react-notion-x-minimal-demo ❌ Failed (Inspect) May 7, 2025 9:44am

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

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Search dialog could spin infinitely

1 participant

AltStyle によって変換されたページ (->オリジナル) /