Skip to content
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

Use GraphQL mutations for FLEx metadata updates #973

Merged
merged 4 commits into from
Jul 25, 2024

Conversation

rmunn
Copy link
Contributor

@rmunn rmunn commented Jul 19, 2024

Fixes #970.

This changes updateLexEntryCount and updateLanguageList from being HTTP POST queries to being GraphQL mutations, which means the GraphQL cache is automatically updated when they run. Previously, you could "lose" the updated entry count for a project by navigating away from it and back to the project without a browser reload, because the result of calling updateLexEntryCount was being stored on the page but not actually sent to the GraphQL query cache, and the second time the project loaded the GraphQL cache would serve up stale data.

Now that those two updates are using GraphQL mutations, and returning the updated values from the mutation, the GraphQL query cache is doing its job and caching the updated values, so navigating away from a project and back to it works as it should.

@rmunn rmunn self-assigned this Jul 19, 2024
Base automatically changed from feat/extract-langtags-from-flex-projects to develop July 23, 2024 02:06
@rmunn rmunn force-pushed the feat/gql-mutations-for-flex-metadata branch from 27288f0 to cfdb9a6 Compare July 23, 2024 02:08
Copy link

github-actions bot commented Jul 23, 2024

UI unit Tests

12 tests  ±0   12 ✅ ±0   0s ⏱️ ±0s
 4 suites ±0    0 💤 ±0 
 1 files   ±0    0 ❌ ±0 

Results for commit bebba76. ± Comparison against base commit fa97734.

♻️ This comment has been updated with latest results.

@rmunn
Copy link
Contributor Author

rmunn commented Jul 23, 2024

Interesting: once I merged #970, GitHub automatically adjusted the base of this PR:

image

So all I had to do was run git rebase -i develop and delete the commits from #970, and then force-push the rebase. That was a lot less work than I thought it would be.

Copy link

github-actions bot commented Jul 23, 2024

C# Unit Tests

53 tests  ±0   53 ✅ ±0   5s ⏱️ ±0s
10 suites ±0    0 💤 ±0 
 1 files   ±0    0 ❌ ±0 

Results for commit bebba76. ± Comparison against base commit fa97734.

♻️ This comment has been updated with latest results.

@rmunn rmunn requested a review from hahn-kev July 23, 2024 06:40
hahn-kev
hahn-kev previously approved these changes Jul 23, 2024
Copy link
Collaborator

@hahn-kev hahn-kev left a comment

Choose a reason for hiding this comment

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

Looks good, though I'd prefer the update missing versions be left in the controller as I intend to call them manually via swagger and that's much better than trying to call the mutation manually

backend/LexBoxApi/GraphQL/ProjectMutations.cs Outdated Show resolved Hide resolved
Corresponding ProjectController methods will be removed later.
Now the UI updates itself when the GraphQL query is run, and the GraphQL
cache is automatically updated with the correct values.
Instead of GraphQL calls, the batch "update X where missing" calls are
more useful as HTTP POSTs so that they can be easily called from the
Swagger UI. We're never going to call those from the frontend anyway.
@rmunn rmunn force-pushed the feat/gql-mutations-for-flex-metadata branch from cb7f2f7 to bebba76 Compare July 25, 2024 04:21
@rmunn rmunn requested a review from hahn-kev July 25, 2024 04:21
@rmunn rmunn merged commit 7b46d85 into develop Jul 25, 2024
14 checks passed
@rmunn rmunn deleted the feat/gql-mutations-for-flex-metadata branch July 25, 2024 04:27
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.

Change updateLexEntryCount and updateLanguageList to be GQL mutations instead of HTTP POST endpoints
2 participants