Skip to content

Conversation

mushroomgenie
Copy link

@mushroomgenie mushroomgenie commented Aug 9, 2025

Description

This PR solves the issue where upon removing a filter, the results page was not defaulting to page 1.

Type of Change

Please mark the relevant option(s):

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📝 Documentation update
  • 🎨 UI/UX improvement
  • ♻️ Code refactoring
  • ⚡ Performance improvement
  • ✅ Test update
  • 🔧 Configuration change

Related Issues

Fixes #82

Screenshots/Recordings

Before

defaultFilterBug

After

defaultFilterFix

emptyFilterFix

Testing

Please confirm the following:

  • I have tested these changes locally
  • I have added/updated tests for these changes (if applicable)
  • All existing tests pass
  • I have tested on different screen sizes (if UI changes)
  • I have tested with different themes (if UI changes)

Test Instructions

Additional Notes

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

@sahithvibudhi
Copy link
Contributor

@mushroomgenie I think the right fix here is to call executeQuery when the cross button to remove filter is clicked.

@mushroomgenie
Copy link
Author

@sahithvibudhi I have fixed it that way only if I am not wrong, executeQuery runs when filters change(filters is now a dependency) and the state variable changesApplied is true. Can you review again ?

@Krishnachaitanyakc
Copy link
Collaborator

@mushroomgenie let's also attach a recording to show the before and after

@mushroomgenie
Copy link
Author

@Krishnachaitanyakc I have updated the PR comment with the recordings.

Copy link
Collaborator

@sathvik-palley sathvik-palley left a comment

Choose a reason for hiding this comment

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

my optimal way for this issue would be to run executeQuery() when filters change, this approach will involve adding filters variable to a useEffect hook.

@mushroomgenie
Copy link
Author

@sathvik-palley I have wrapped the executeQuery function in a useCallback with filters being one of its dependencies and executeQuery itself is being called inside a useEffect. I have used this approach as executeQuery is an asynchronous function, calling it directly inside a useEffect with dependencies would cause unnecessary re renders.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Result panel not defaulting after closing a filter

4 participants