Skip to content

bug(react): source hooks freeze initial configuration options #391

Description

@vamgan

Summary

The audit performed while fixing #373 found the same initial-render option capture pattern in additional React source hooks. Several source factories are memoized for the component lifetime while closing over source options from the first render.

Concrete examples:

  • useAskableDOMSource: target selection (ref/selector), includeAttributes, includeHTML, maxTextLength, describe, and kind
  • useAskableScrollSource: target selection (ref/selector/getElement), getActiveSection, describe, and kind
  • state-backed source hooks commonly keep snapshot data current through refs but can still freeze configuration such as describe, kind, caps, filters, and source-specific options

This is separate from the navigation-specific fix in #373 and should be handled systematically rather than expanding that PR.

Expected behavior

Source hook options should reflect the latest committed React render without:

  • re-registering the source
  • exposing callbacks from abandoned concurrent renders
  • resetting source-owned state/history unnecessarily
  • silently freezing scalar or callback options from mount

Acceptance criteria

  • Audit every React useAskable*Source factory with an empty or intentionally narrow memo dependency list
  • Add rerender regressions for each confirmed stale option class
  • Add a suspended/abandoned-render regression for any shared latest-value helper
  • Keep registrations stable across option changes
  • Preserve source-owned state when options change
  • Verify SSR behavior and the full React/workspace suites

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: reactReact adapter workbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions