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.
Description
Switches away from
useQuery()
as the mechanism of executing the user provided query. Instead it usesuseMutation()
.This is to prevent unintended executions of the query.
useQuery
is designed to be executed when React renders the view. But that is not desired in this case. Especially if the user happens to be running an actual Gremlin mutation query. That could lead to multiple nodes created/modified/deleted.The mutation version only executes when called. This means if the view is unmounted and remounted, then the query results are lost. The user must re-run the query explicitly. While I'm sure I could find a way to somehow persist these results in a way that makes sense, there's not a simple solution. So I'm kicking the can down the road to a future where that functionality is asked for explicitly.
As a result of this change, I can no longer reuse
SearchResultList
component. So I duplicated and modified that view for the raw query mutation. This removes the cancel button (which didn't work) and customizes the loading and error messages to be more appropriate for the context.Validation
Related Issues
Check List
license.
pnpm checks
to ensure code compiles and meets standards.pnpm test
to check if all tests are passing.Changelog.md
.