-
Notifications
You must be signed in to change notification settings - Fork 46
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
fix(web): layer style boolean selector field doesn't work properly with string value #1322
Conversation
WalkthroughThe pull request modifies the Changes
Suggested labels
Suggested reviewers
Possibly related PRs
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
✅ Deploy Preview for reearth-web ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
web/src/beta/features/Editor/Map/LayerStylePanel/Editor/StyleInterface/StyleNode/Field/BooleanSelectorInput.tsx
(1 hunks)
🔇 Additional comments (2)
web/src/beta/features/Editor/Map/LayerStylePanel/Editor/StyleInterface/StyleNode/Field/BooleanSelectorInput.tsx (2)
10-10
: LGTM! Type extension maintains clean API boundaries.
The Props type extension to accept string values while keeping the onChange handler returning boolean maintains a clean external API contract. This is a good approach as it handles the type conversion internally without leaking implementation details.
Line range hint 1-33
: Verify component usage patterns in layer styles.
Let's ensure this change doesn't introduce regressions in existing layer style implementations.
✅ Verification successful
Component usage patterns verified, implementation is safe
The verification shows that the BooleanSelectorInput component is properly integrated within the layer style system:
- It's correctly used in the Field component's mapping with proper type casting:
value={props.value as boolean}
- The component handles both boolean and string values, which aligns with the style system's needs
- No direct string assignments were found that could cause issues
- The type definitions in the codebase show consistent boolean handling patterns
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check usage patterns of BooleanSelectorInput in layer styles
# Find all files that import or use BooleanSelectorInput
rg -l "BooleanSelectorInput"
# Check for any direct string value assignments to the component
ast-grep --pattern 'BooleanSelectorInput value="$_"'
# Look for layer style related files that might pass string values
rg -l "LayerStyle.*boolean"
Length of output: 429
Script:
#!/bin/bash
# Let's check how BooleanSelectorInput is used in the parent components
# Check the usage in index.tsx
rg -A 10 "BooleanSelectorInput" "web/src/beta/features/Editor/Map/LayerStylePanel/Editor/StyleInterface/StyleNode/Field/index.tsx"
# Check the usage in TypographyInput.tsx
rg -A 10 "BooleanSelectorInput" "web/src/beta/features/Editor/Map/LayerStylePanel/Editor/StyleInterface/StyleNode/Field/TypographyInput.tsx"
# Look for any boolean type definitions in style interfaces
rg "boolean.*;" "web/src/beta/features/Editor/Map/LayerStylePanel"
Length of output: 2847
...es/Editor/Map/LayerStylePanel/Editor/StyleInterface/StyleNode/Field/BooleanSelectorInput.tsx
Show resolved
Hide resolved
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1322 +/- ##
==========================================
- Coverage 31.57% 23.07% -8.50%
==========================================
Files 392 1029 +637
Lines 38617 106556 +67939
Branches 0 662 +662
==========================================
+ Hits 12193 24592 +12399
- Misses 25177 80717 +55540
Partials 1247 1247
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Overview
The incoming value for boolean could be in type of string, this PR supports check value with string
true
false
.What I've done
What I haven't done
How I tested
Story: https://www.notion.so/eukarya/visualizer-reearth-io-User-Stories-V2-13a16e0fb165800ba026f7569c8dd4b2?p=13b16e0fb16580408611c56dd9d0aa23&pm=s
Which point I want you to review particularly
Memo
Summary by CodeRabbit
New Features
BooleanSelectorInput
to accept both boolean and string representations of boolean values.Bug Fixes
value
prop to ensure proper conversion between string and boolean types.