-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(core): enter & leave traverse handlers #21
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
commit: |
ab3bcb5
to
1044194
Compare
|
#18
@aidenybai I have refactored the
traverseFiber
into stack-based implementation and can accept an object syntax with enter & leave handlers. But it can also accept the previous selector handler as an enter handler.I changed the jsx option from
react
toreact-jsx
for resolving some biome warnings. But it might be bring some compatiable issues to applications with legacy jsx runtime react version. Not sure is it acceptable.This pull request includes several changes to the testing setup and the
traverseFiber
function. The most important changes involve adding new tests fortraverseFiber
, enhancing thetraverseFiber
function, and updating the test configuration.Enhancements to
traverseFiber
function:src/core.ts
: IntroducedFiberSelector
type andTraverseFiberOptions
interface to improve the flexibility of thetraverseFiber
function. The function now supports both entry and leave handlers and can traverse the fiber tree in ascending order.New tests for
traverseFiber
:src/core.test.tsx
: Added comprehensive tests for thetraverseFiber
function, including tests for traversing in both directions, handling entry and leave events, and verifying stack behavior.Updates to testing setup:
setup-test.ts
: Added an import for./src/rdt-hook
to the test setup file.vitest.config.ts
: Updated the test configuration to includesetupFiles
pointing to./setup-test.ts
.