fix(update-banner): fetch /version once by keying on a memoized admin flag (MAPPS-187) #180
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/MAPPS-187-version-dedup"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Completes MAPPS-187. The earlier PR (#176, merged) stopped the generation-keyed list resources from double-fetching on mount. This fixes the remaining
/versionduplicate: theUpdateBannerversion_resource read the wholeauthcontext, so it re-ran every time auth was written - and auth is written more than once during startup (OIDC callback, then rehydration) with the same user, firing a secondGET /api/v1/versionon every page.Change
Derive
is_adminwithuse_memoand key the resource (and the early-return) on that. AMemo<bool>only notifies when its value flips, so a redundant auth re-write with the same admin status no longer re-runs the resource./versionis fetched once.Testing
cargo clippy --all-targets -- -D warnings: clean.cargo check --target wasm32-unknown-unknown: clean.cargo fmt --all --check: clean.