-
Notifications
You must be signed in to change notification settings - Fork 109
chore: disable move linked view #206
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
Conversation
Reviewer's GuideImplements centralized logic to prevent moving linked database views (and other restricted views) by adding Sequence diagram for the new move restriction logic in MoreActionsContentsequenceDiagram
actor User
participant MoreActionsContent
participant ViewUtils
User->>MoreActionsContent: Open more actions menu for viewId
MoreActionsContent->>MoreActionsContent: useMemo to find view
MoreActionsContent->>MoreActionsContent: useMemo to find parentView
MoreActionsContent->>ViewUtils: canBeMoved(view, parentView)
activate ViewUtils
ViewUtils->>ViewUtils: isReferencedDatabaseView(view, parentView)
ViewUtils-->>MoreActionsContent: false or true
alt Referenced database view
ViewUtils-->>MoreActionsContent: false
else Not referenced database view
ViewUtils->>ViewUtils: isDatabaseContainer(parentView)
alt Parent is database container
ViewUtils-->>MoreActionsContent: false
else Parent is not database container
ViewUtils->>ViewUtils: isLinkedDatabaseViewUnderDocument(view, parentView)
ViewUtils->>ViewUtils: isDatabaseLayout(view.layout)
ViewUtils->>ViewUtils: isDatabaseContainer(view)
ViewUtils->>ViewUtils: isEmbeddedView(view)
ViewUtils-->>MoreActionsContent: false or true
end
end
deactivate ViewUtils
MoreActionsContent->>MoreActionsContent: disabled = !canBeMoved(view, parentView)
alt disabled is true
MoreActionsContent-->>User: MoveTo menu item shown as disabled
else disabled is false
MoreActionsContent-->>User: MoveTo menu item enabled
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location> `src/components/app/header/MoreActionsContent.tsx:94` </location>
<code_context>
e.preventDefault();
}}
- disabled={parentLayout !== ViewLayout.Document}
+ disabled={!canBeMoved(view, parentView)}
>
<MoveToIcon />
</code_context>
<issue_to_address>
**issue:** Guard against `view` being null/undefined so the Move action doesn’t appear enabled while the view is still loading or missing.
Right now `canBeMoved` is called with `null`/`undefined` while `useView` is loading, so it may return `true` and enable the menu before a valid view exists. Instead, consider:
```tsx
disabled={!view || !canBeMoved(view, parentView)}
```
This keeps the menu state in sync with loading and avoids invoking move logic with an invalid `view`.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| e.preventDefault(); | ||
| }} | ||
| disabled={parentLayout !== ViewLayout.Document} | ||
| disabled={!canBeMoved(view, parentView)} |
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.
issue: Guard against view being null/undefined so the Move action doesn’t appear enabled while the view is still loading or missing.
Right now canBeMoved is called with null/undefined while useView is loading, so it may return true and enable the menu before a valid view exists. Instead, consider:
disabled={!view || !canBeMoved(view, parentView)}This keeps the menu state in sync with loading and avoids invoking move logic with an invalid view.
Description
Checklist
General
Testing
Feature-Specific
Summary by Sourcery
Restrict when views can be moved and align web behavior with desktop/Flutter logic for draggable views.
New Features:
Enhancements:
Tests: