# Problem code `'read-while-queued'`

> Contract 2.0.0 · package sha256 `a857eca95b35921109faf997094bb4192f12527d9d0fcd4be7e97f06425bad6e` · generated from `configurator-runtime.d.ts`, `tables/problems.json` and `services/onsite-scripter/scripts/contract-docs-what-to-do.json` by `services/onsite-scripter/scripts/build-contract-docs.mjs`; edit the source, not this file.

A member of [`ProblemCode`](../api/ProblemCode.md) · stable · since 2.0.0

Strict fake only: code read a target that still had a write queued behind a transaction.

## What to do

Don't read a target back with [`session.state()`](../api/Writer.state.md) while its write is queued behind a transaction: show the value you wrote, then correct it from the write's Report once it settles. Inside a transaction's `work`, read through `tx` (`tx.getSceneModel()`, `tx.state()`), never `session`: a `tx` read sees the transaction's staged writes and records nothing.

```ts
label.text = name;
const r = await session.select(group, material);
if (r.outcome !== 'committed') label.text = previous;
```

## Where the declaration names it

- [`Session.transaction`](../api/Session.transaction.md): A `session` read of a target that has a write queued behind the transaction, in `work` or anywhere else on the page, is unspecified (the old or the queued value) until that write applies, and the strict fake records 'read-while-queued' for it ([`FakeSessionOptions.strict`](../api/testing.FakeSessionOptions.strict.md)).
- [`testing.FakeSessionOptions.strict`](../api/testing.FakeSessionOptions.strict.md): Throws the runtime's errors and records every Problem, plus fake-only checks: a wrong-writer write after an `await` (tracked with AsyncLocalStorage) throws HoloScopeError; a `session` read of a target with a write queued behind an open transaction records 'read-while-queued', inside `work` too, while a read through that transaction's `tx` records nothing (read through `tx` inside `work`); a call…

The set is open: handle a code you don't know (`'other'`).

## Recorded by

- the table row `failure-matrix/cases/read-while-queued` (`tables/failure-matrix.json`)
