-
Notifications
You must be signed in to change notification settings - Fork 28
feat(core): enter & leave traverse handlers #21
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
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
traverseFiberinto 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
reacttoreact-jsxfor 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
traverseFiberfunction. The most important changes involve adding new tests fortraverseFiber, enhancing thetraverseFiberfunction, and updating the test configuration.Enhancements to
traverseFiberfunction:src/core.ts: IntroducedFiberSelectortype andTraverseFiberOptionsinterface to improve the flexibility of thetraverseFiberfunction. 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 thetraverseFiberfunction, 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-hookto the test setup file.vitest.config.ts: Updated the test configuration to includesetupFilespointing to./setup-test.ts.