fix: scan does not accept expected options#397
Conversation
|
Someone is attempting to deploy a commit to the Million Team on Vercel. A member of the Team first needs to authorize it. |
a5e3edf to
deac373
Compare
|
@pivanov @RobPruzan Could you review this PR when free? Thanks! |
pivanov
left a comment
There was a problem hiding this comment.
will r+ this one but I think @RobPruzan can merge it
|
@RobPruzan Would you be able to merge this PR? Thanks a lot |
|
we should probably just delete the local storage option stuff i dont know why we're doing that |
|
thanks for the contribution! |
|
@RobPruzan Hi! I noticed that after this PR was merged, the function filetLocalStorageOptions was removed and replaced with applyLocalStorageOptions by commit 589b2dc, but the call site wasn't updated accordingly, which is now causing a runtime error. I've submitted a follow-up PR to fix it: [#398]. Thanks! |
oops 😭 , thanks for the catch |
|
acts as a reminder to not update PR's from the github UI |
Title:
scandoes not accept expected options such as_debug,onCommitStart,onRender,onCommitFinish,onPaintStart,onPaintFinishDescription
When passing the following options to
scan, they are not recognized as expected:_debugonCommitStartonRenderonCommitFinishonPaintStartonPaintFinishInvestigation
After some investigation, I found that in
packages/scan/src/core/index.ts, the function for filtering option keys is as follows:However, the default options defined in
ReactScanInternals.optionsdo not include the above parameters, so they are filtered out during this check.Fix Description
This fix refactors how option keys are filtered and stored in
scan:Removal of
isOptionKey:I believe the
isOptionKeyfunction is unnecessary for the following reasons:validOptionsduring validation, so they are naturally filtered out.Improved Local Storage Filtering:
When saving options to local storage, the code now uses the
LocalStorageOptionstype to filter out unnecessary parameters, such as callback functions and internal flags. This ensures that only relevant options are persisted, and special parameters likeonCommitStart,onRender, etc., are excluded from storage but still available for use at runtime.