# RefSubject.reset

Resets a `RefSubject` to its initial value, returning the previous value if it existed.

## Signatures

```ts
export declare function reset<A, E, R>(ref: RefSubject<A, E, R>): Effect.Effect<Option.Option<A>, E, R>;
```

## Why

Resets a `RefSubject` to its initial value, returning the previous value if it existed. The
transition is serialized at the RefSubject rather than coordinated by callers or UI components.

## Ownership and lifetime

Running reset performs one serialized subject transition and resolves with its committed value.
It acquires no resource; failures and services remain those of the source ref.

## Examples

```ts
import { Effect, Option } from "effect"
import * as RefSubject from "@typed/fx/RefSubject"

const program = Effect.gen(function* () {
  const count = yield* RefSubject.make(0)

  yield* RefSubject.set(count, 5)
  const before = yield* count
  console.log(before) // 5

  // Reset to initial value
  const previous = yield* RefSubject.reset(count)
  console.log(Option.isSome(previous)) // true
  console.log(previous.value) // 5

  const after = yield* count
  console.log(after) // 0
})
```
