Support `.callHookOnce`
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 960
- Forks
- 43
- Avg merge
- 19m
- Merged PRs (30d)
- 1
Description
Describe the feature
Usually, there are some hooks that are to be called only once.
In the current API, it is delegated to hook consumers to use hookOnce on them; if they don't and use hook insteam, small callbacks might remain in memory.
A new .callHookOnce API can make sure it from provider-side and automatically discard all listeners after.
Second idea: We could also warn if a hook register attempt after callOnce that it won't be called and likely a late register issue
Additional information
- Would you be willing to help implement this feature?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the repository's existing hook and hookOnce APIs and their tests. Determine the expected provider-side behavior for a new callHookOnce API, including listener disposal and the optional warning for late registrations. Done means the API behavior is covered by tests and its listener lifecycle is unambiguous.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- developer-experience, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100