Skip to content

Conversation

@jacbn
Copy link
Contributor

@jacbn jacbn commented Jan 21, 2026

Also adds a few tests to check this in future.


In as brief as I can, the user object is sometimes available on load (if you came via soft redirect), and sometimes not (if not). This means our original populateFiltersFromAccountSettings function was not running on soft reload, because the user object had not changed (thus not triggering the useEffect).

I have fixed this by pulling the logic from populateFiltersFromAccountSettings into external functions, which are also used in the initial values for searchStages and searchExamBoards provided the user is available then. This means that no matter when the user is available, we always run the same logic.

Also adds a few tests to check this in future.
const searchAndUpdateURL = useCallback(() => {
setPageCount(1);

debouncedSearch.cancel();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This isn't strictly part of the fix for this PR, but this kills off stale requests before they update state later which fixes a lot of random inconsistency with tests! :)

@codecov
Copy link

codecov bot commented Jan 21, 2026

Codecov Report

❌ Patch coverage is 94.28571% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 42.60%. Comparing base (640fa15) to head (6ef0186).

Files with missing lines Patch % Lines
src/app/components/pages/QuestionFinder.tsx 94.28% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1936      +/-   ##
==========================================
+ Coverage   42.35%   42.60%   +0.25%     
==========================================
  Files         575      575              
  Lines       24390    24411      +21     
  Branches     8085     8056      -29     
==========================================
+ Hits        10330    10401      +71     
+ Misses      13396    13346      -50     
  Partials      664      664              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

2 participants