SIGN IN SIGN UP

docs: Stop implying that closing a session destroys its reactives (#4423)

* docs: Stop implying that closing a session destroys its reactives

#4421 made a whole-session close leave reactive values and expressions
readable, and documented that on the `onDestroy(callback)` entry of
`?session`. The neighboring `destroy(namespace)` entry was left alone, and
it still read the old way: it lists the reactive state that teardown
cleans up ("all reactive values, observers, and reactive expressions
created within that scope") and then closes with "the root session is
torn down via `close()`". Read in sequence, that is exactly the inference
#4421 set out to remove -- and inside `ShinySession` the `onDestroy` and
`destroy` R6 docstrings now contradicted each other outright.

Scope the teardown list to an explicit `destroy()`, and say what `close()`
actually does: observers are torn down, reactive values and expressions
are left readable at their last value.

Three related spots:

- The error raised when `destroy()` is called on the root session without
  a namespace offered `close()` as the way "to tear down the whole
  session". That is the one place a user reaching for whole-session
  teardown actually reads, so it should not present close as the
  destroy-everything equivalent.
- "A reactive value created inside a module is destroyed with the module"
  had no anchor to an explicit `destroy()` call, so "with the module"
  invited the session-close reading. Anchored.
- `MockShinySession$onDestroy` never got #4421's clarification even
  though its `close()` fires root destroy callbacks, unlike its
  `ShinySession` counterpart. Added, matching that wording.

Docs and comments only; no behavior change.

* docs: Point the NEWS entry at the PR number

* Apply suggestion from @schloerke
B
Barret Schloerke committed
ef93041ff7cbef679dbc37f527e09427eaf8d80a
Parent: 4b2b92a
Committed by GitHub <noreply@github.com> on 8/10/2026, 7:15:53 PM