feat(core): enter & leave traverse handlers - #21
Open
Asuka109 wants to merge 7 commits into
Open
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
commit: |
Asuka109
force-pushed
the
feat/traverser-leave-handler
branch
from
January 22, 2025 16:22
ab3bcb5 to
1044194
Compare
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#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.