open-source-labs / open-source-labs/Reactime

Expanding Support for Custom Hooks

Open
#352 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
TypeScript
Stars
2.2k
Forks
210
PR merge metrics
No merged PRs in 30d

Description

Problem

Reactime currently has a robust system for detecting and handling built-in React hooks, but custom hooks present unique opportunities and challenges for state tracking and visualization.

Current Implementation:

Reactime uses AST parsing via @babel/parser to analyze hook usage in components The system identifies hook patterns through memoizedState examination in the Fiber tree Hook names and state variables are extracted and matched with their corresponding state values This works well for direct useState and useReducer calls but may miss custom hook implementations

Challenges:

Custom hooks can contain multiple internal state management hooks The relationship between custom hook state and component state is not always clear in the Fiber tree Hook naming patterns may vary across different custom hook implementations State updates in custom hooks might use complex patterns or composition The current AST parsing system is optimized for standard hook patterns

Solution

Future Considerations Teams looking to expand custom hook support should consider:

How to identify and group state belonging to the same custom hook Ways to visualize the relationship between custom hook state and component state Methods to track state flow through custom hook composition Approaches for handling custom hooks that combine multiple state management methods Strategies for maintaining time travel functionality with custom hook state

Additional information

No response

👨‍👧‍👦 Contributing
  • 🙋‍♂️ Yes, I'd love to make a PR to implement this feature!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Begin by tracing the existing @babel/parser hook analysis and memoizedState examination described in the issue, including current useState and useReducer handling. The work is not ready for implementation until the project defines how custom-hook state is grouped, visualized, composed, and supported by time travel; no file or test is named.

Written by the indexing model from the issue text.

Assessment

Tech stack
babel, react, typescript
Domain
devtools, frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.