fix(ui): seed RTK Query cache after create/update mutations#6217
Conversation
Signed-off-by: Jon Gaul <jgaul3@gmail.com>
There was a problem hiding this comment.
Verdict: approve
This PR cleanly replaces RTK Query tag invalidation with explicit cache seeding via onQueryStarted to fix the read-after-write consistency issues described. The pattern is applied consistently across flags, segments, and branch environments; return types are corrected to match actual API responses; duplication is reduced with enrichFlag/enrichSegment helpers; and Playwright tests are strengthened to verify immediate UI consistency. No issues found.
🤖 Automated review by the Flipt PR review agent.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## v2 #6217 +/- ##
=======================================
Coverage 62.27% 62.27%
=======================================
Files 145 145
Lines 14815 14815
=======================================
Hits 9226 9226
Misses 4829 4829
Partials 760 760
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Description
When I use flipt, I find I have to refresh a time or two after making changes for those changes to be reflected in the UI. I'm quite certain this is a read-after-write bug arising from using
invalidatesTagsrather than updating those tags. This PR updates them to generally useonQueryStartedinstead.This applies to creating, updating, and deleting flags and segments, as well as creating branches.
I tested things out locally but since it's partially a network thing that's mostly to confirm that basic processes still work.