Skip to content
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): edit sketch custom properties [VIZ-1429] #1531

Merged
merged 1 commit into from
Mar 28, 2025

Conversation

mkumbobeaty
Copy link
Contributor

@mkumbobeaty mkumbobeaty commented Mar 27, 2025

Overview

What I've done

What I haven't done

How I tested

Which point I want you to review particularly

Memo

Summary by CodeRabbit

  • Refactor
    • Streamlined the custom property editing interface by removing outdated callbacks and handlers.
    • Enhanced internal state management to simplify interactions, contributing to a more stable and consistent experience for users.

Copy link

coderabbitai bot commented Mar 27, 2025

Walkthrough

The changes remove legacy callback functionality related to custom property schema state management. In the modal component, the optional onCustomPropertySchemaState callback was removed along with its invocation in the openEditFieldConfirmModal function, and its dependency was cleared. Additionally, the handleCustomPropertySchemaState function is removed from the return object of the custom hook and from the component prop destructuring. These modifications simplify the component interface and internal control flow across the related files.

Changes

Files Change Summary
web/src/beta/features/Editor/Map/InspectorPanel/LayerInspector/DataSource/SketchCustomProperties/CustomPropertyFieldModal.tsx Removed the onCustomPropertySchemaState callback from the props and its invocation in openEditFieldConfirmModal; updated the useCallback dependency to an empty array.
web/src/beta/features/Editor/Map/InspectorPanel/LayerInspector/DataSource/SketchCustomProperties/hooks.ts
web/src/beta/features/Editor/Map/InspectorPanel/LayerInspector/DataSource/SketchCustomProperties/index.tsx
Removed the handleCustomPropertySchemaState function from the hook's return object and from the component's prop destructuring.

Sequence Diagram(s)

sequenceDiagram
    participant UI as CustomPropertyFieldModal
    participant Modal as openEditFieldConfirmModal
    UI->>Modal: Trigger edit action
    Modal-->>UI: Execute logic without invoking callback
Loading
sequenceDiagram
    participant Component as CustomPropertiesSchema
    participant Hook as useHooks
    Component->>Hook: Destructure returned values
    Note over Hook: "handleCustomPropertySchemaState" removed
    Component-->>Component: Use remaining hook handlers
Loading

Possibly related PRs

Poem

I'm a rabbit in the code so neat,
Hopping over callbacks now obsolete,
Removing functions with a swift little bound,
Simplifying logic without a sound,
🐇 CodeRabbit cheers in joyful beat!


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cb53d0d and 5f6138f.

📒 Files selected for processing (3)
  • web/src/beta/features/Editor/Map/InspectorPanel/LayerInspector/DataSource/SketchCustomProperties/CustomPropertyFieldModal.tsx (1 hunks)
  • web/src/beta/features/Editor/Map/InspectorPanel/LayerInspector/DataSource/SketchCustomProperties/hooks.ts (0 hunks)
  • web/src/beta/features/Editor/Map/InspectorPanel/LayerInspector/DataSource/SketchCustomProperties/index.tsx (0 hunks)
💤 Files with no reviewable changes (2)
  • web/src/beta/features/Editor/Map/InspectorPanel/LayerInspector/DataSource/SketchCustomProperties/index.tsx
  • web/src/beta/features/Editor/Map/InspectorPanel/LayerInspector/DataSource/SketchCustomProperties/hooks.ts
⏰ Context from checks skipped due to timeout of 90000ms (6)
  • GitHub Check: ci-web / ci
  • GitHub Check: ci-server / ci-server-test
  • GitHub Check: ci-server / ci-server-lint
  • GitHub Check: Redirect rules - reearth-web
  • GitHub Check: Header rules - reearth-web
  • GitHub Check: Pages changed - reearth-web
🔇 Additional comments (4)
web/src/beta/features/Editor/Map/InspectorPanel/LayerInspector/DataSource/SketchCustomProperties/CustomPropertyFieldModal.tsx (4)

65-67: Improved callback implementation with reduced dependencies

The openEditFieldConfirmModal function no longer has any dependencies in its dependency array, which is a good simplification. This indicates the removal of the onCustomPropertySchemaState callback usage that was previously invoked in this function, aligning with the broader removal of this callback from the component interface.


28-39: Cleanup of unused props in CustomPropertyFieldProps

The removal of the onCustomPropertySchemaState optional callback from the props interface is a positive cleanup that matches the functional changes in the component. This simplifies the component API and makes the component more focused on its core responsibilities.


47-54: Clean prop destructuring after interface simplification

The component's prop destructuring correctly reflects the updated interface, no longer including the removed onCustomPropertySchemaState callback. This ensures consistency between the type definition and its usage.


119-163: Verify that handleSubmit behaves correctly with the simplified dependencies

The handleSubmit function still works correctly without relying on the removed callback. The function handles both the creation of new properties and editing of existing ones, ensuring proper state management and calling appropriate callbacks.

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

netlify bot commented Mar 27, 2025

Deploy Preview for reearth-web ready!

Name Link
🔨 Latest commit 5f6138f
🔍 Latest deploy log https://app.netlify.com/sites/reearth-web/deploys/67e5114992a3d90008634dc3
😎 Deploy Preview https://deploy-preview-1531--reearth-web.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@mkumbobeaty mkumbobeaty marked this pull request as ready for review March 27, 2025 08:50
@mkumbobeaty mkumbobeaty requested a review from airslice as a code owner March 27, 2025 08:50
@airslice airslice merged commit 2003afd into main Mar 28, 2025
22 checks passed
@airslice airslice deleted the fix/sketchlayer-edit branch March 28, 2025 06:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants