ErrorsReads and writes · rule
data.stored_value_outside_update
Stored field read outside an update by id.
Area 6, Reads and writes; not declinable; the next step is usually the agent's.
Counter.hits is the value stored when an update by id runs, so only
that update reads it:
type Count = Int { min: 0}entity Counter { id: Uuid hits: Count}action hit(counter: Counter) -> Counter { return Counter.update(counter) { set: { hits: Count(Counter.hits + 1) } }}
error Counter.hits is a stored value, read only by an update by id
--> main.jadpo:13:25
|13 | hits: Count(Counter.hits + 1) | ^^^^^^^^^^^^ stored value
- reason
Counter.hitsis the value stored in the database when an update byidruns, which only that update'sset:reads; elsewhere a record's field is read from the record loaded earlier.- next
- Read it from a loaded record,
counter.hits, or use it inCounter.update(counter_id) { set: { ... } }(agent) - rule
- data.
stored_ value_ outside_ update - help
- https://jadpo.
dev/docs/errors/data. stored_ value_ outside_ update
Markdown for agents: /docs/errors/data.stored_value_outside_update.md.Built from Jadpo main at aee2e8f.