Skip to content

Fix Inspect View showing stale sample data#3325

Merged
dragonstyle merged 2 commits intoUKGovernmentBEIS:mainfrom
rasmusfaber:faber/fix-stale-sample-display
Feb 27, 2026
Merged

Fix Inspect View showing stale sample data#3325
dragonstyle merged 2 commits intoUKGovernmentBEIS:mainfrom
rasmusfaber:faber/fix-stale-sample-display

Conversation

@rasmusfaber
Copy link
Contributor

@rasmusfaber rasmusfaber commented Feb 25, 2026

This PR contains:

  • New features
  • Changes to dev-tools e.g. CI config / github tooling
  • Docs
  • Bug fixes
  • Code refactor

What is the current behavior? (You can also link to an open issue here)

When navigating between samples in Inspect View, the previous sample is shown until the new sample has been loaded, which can be confusing.

What is the new behavior?

Three fixes prevent stale sample display:

  • A generation counter invalidates in-flight API responses when a new sample load starts
  • State preparation is consolidated into a single atomic update (prepareForSampleLoad) instead of three separate calls
  • The render guard no longer shows content while loading or when the loaded sample doesn't match the requested ID

Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)

No.

Other information:

Extracted from #3214

@rasmusfaber rasmusfaber force-pushed the faber/fix-stale-sample-display branch from 27cfa31 to 74f0e84 Compare February 25, 2026 13:07
@rasmusfaber rasmusfaber marked this pull request as ready for review February 26, 2026 13:19
Copy link
Collaborator

@dragonstyle dragonstyle left a comment

Choose a reason for hiding this comment

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

Thanks!

@dragonstyle
Copy link
Collaborator

@rasmusfaber I can't resolve the conflict on the branch, but when you do ping me and I will merge it ASAP to avoid piling up more conflicts.

When clicking between samples quickly, the previous sample's API response
could arrive after the new sample started loading, overwriting the correct
data. Fix with three changes:

- Add generation counter to invalidate in-flight responses from previous loads
- Consolidate three separate state updates into atomic prepareForSampleLoad()
- Fix render guard to not display content while loading or when sample
  doesn't match the requested ID

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@rasmusfaber rasmusfaber force-pushed the faber/fix-stale-sample-display branch from 74f0e84 to c5feaea Compare February 27, 2026 08:22
@rasmusfaber rasmusfaber force-pushed the faber/fix-stale-sample-display branch from c5feaea to 1be8d9c Compare February 27, 2026 08:23
@rasmusfaber
Copy link
Contributor Author

@rasmusfaber I can't resolve the conflict on the branch, but when you do ping me and I will merge it ASAP to avoid piling up more conflicts.

@dragonstyle Done.

@dragonstyle dragonstyle merged commit 63f9f99 into UKGovernmentBEIS:main Feb 27, 2026
14 checks passed
@tadamcz
Copy link
Contributor

tadamcz commented Feb 28, 2026

Life-changing for large samples! Thanks so much @rasmusfaber

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.

3 participants