RTKQ Migration: Question search #1820
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Moves question search logic (QF, Sci subject landing page random question, gameboard builder) to RTKQ. Much of the complicated QF logic regarding pagination and checking for additional results can be achieved entirely within RTKQ, so I have moved this all over. As such, the query is perhaps more involved than others but there is now much better separation between the question search logic and the page display logic on the QF.
The other two use cases of question search will also have to use this flow now, but this is inconsequential for the random question (since the filters it uses are so broad, returning 1 extra result will never take excessive time), and makes no difference to the builder which already requests all available results. This does, however, more easily permit pagination should we wish to make the builder faster to use.
This also makes some minor modifications to
ShowLoadingQuery, notably making use of a query'sisUnitializedprop, which prevents the old logic from displaying an error when before the query has started.