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

Revert "Merge pull request #5348 from voxel51/prompt-on-cancel" #5404

Closed
wants to merge 1 commit into from

Conversation

ritch
Copy link
Contributor

@ritch ritch commented Jan 17, 2025

This reverts commit c5d3bf5, reversing changes made to 55709fb.

Summary by CodeRabbit

  • Refactor

    • Removed cancellation handling across multiple components and files
    • Simplified operator execution and prompt workflows
    • Streamlined component props and hook return types
  • Changes

    • Eliminated onCancel functionality from operator execution
    • Reduced complexity in execution options and state management
    • Removed unused type declarations and callback parameters

The changes focus on simplifying the operator execution process by removing cancellation-related code and reducing unnecessary complexity in the implementation.

This reverts commit c5d3bf5, reversing
changes made to 55709fb.
Copy link
Contributor

coderabbitai bot commented Jan 17, 2025

Walkthrough

This pull request introduces significant changes to the operator execution and cancellation mechanism across multiple files. The modifications primarily focus on removing the on_cancel functionality and simplifying the component interfaces related to operator execution. The changes span both TypeScript/React components in the frontend and Python executor in the backend, streamlining the execution flow by eliminating cancellation-specific logic and reducing the complexity of props and method signatures.

Changes

File Change Summary
app/packages/core/src/plugins/SchemaIO/components/OperatorExecutionButtonView.tsx Removed ExecutionCancelCallback import, on_cancel prop, and handleOnCancel function; simplified icon prop management
app/packages/core/src/plugins/SchemaIO/components/TooltipProvider.tsx Removed component="span" prop from Box, defaulting to standard rendering
app/packages/operators/src/built-in-operators.ts Removed on_cancel parameter and handling from PromptUserForOperation class
app/packages/operators/src/components/OperatorExecutionButton/index.tsx Removed executorOptions, onCancel, and prompt props
app/packages/operators/src/components/OperatorExecutionTrigger/index.tsx Updated props and integrated new hooks for operator execution
app/packages/operators/src/state.ts Simplified useOperatorExecutionOptions return type and useOperatorPrompt cancellation logic
app/packages/operators/src/types-internal.ts Removed ExecutionCancelCallback type
app/packages/operators/src/usePanelEvent.ts Removed onCancel from HandlerOptions type
fiftyone/operators/executor.py Removed on_cancel parameter from prompt method in ExecutionContext

Possibly related PRs

Suggested reviewers

  • imanjra

Poem

🐰 A Rabbit's Ode to Code Simplification 🔧

Cancellation hooks, we bid adieu,
Streamlined paths, our code rings true
No more complexity to fight
Execution flows now clean and bright
Hop along, refactored delight! 🚀


📜 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 858ea58 and d6e1b02.

📒 Files selected for processing (9)
  • app/packages/core/src/plugins/SchemaIO/components/OperatorExecutionButtonView.tsx (1 hunks)
  • app/packages/core/src/plugins/SchemaIO/components/TooltipProvider.tsx (1 hunks)
  • app/packages/operators/src/built-in-operators.ts (1 hunks)
  • app/packages/operators/src/components/OperatorExecutionButton/index.tsx (1 hunks)
  • app/packages/operators/src/components/OperatorExecutionTrigger/index.tsx (3 hunks)
  • app/packages/operators/src/state.ts (1 hunks)
  • app/packages/operators/src/types-internal.ts (0 hunks)
  • app/packages/operators/src/usePanelEvent.ts (2 hunks)
  • fiftyone/operators/executor.py (0 hunks)
💤 Files with no reviewable changes (2)
  • app/packages/operators/src/types-internal.ts
  • fiftyone/operators/executor.py
✅ Files skipped from review due to trivial changes (1)
  • app/packages/core/src/plugins/SchemaIO/components/TooltipProvider.tsx
🧰 Additional context used
📓 Path-based instructions (6)
app/packages/operators/src/usePanelEvent.ts (1)

Pattern **/*.{ts,tsx}: Review the Typescript and React code for conformity with best practices in React, Recoil, Graphql, and Typescript. Highlight any deviations.

app/packages/operators/src/components/OperatorExecutionButton/index.tsx (1)

Pattern **/*.{ts,tsx}: Review the Typescript and React code for conformity with best practices in React, Recoil, Graphql, and Typescript. Highlight any deviations.

app/packages/core/src/plugins/SchemaIO/components/OperatorExecutionButtonView.tsx (1)

Pattern **/*.{ts,tsx}: Review the Typescript and React code for conformity with best practices in React, Recoil, Graphql, and Typescript. Highlight any deviations.

app/packages/operators/src/components/OperatorExecutionTrigger/index.tsx (1)

Pattern **/*.{ts,tsx}: Review the Typescript and React code for conformity with best practices in React, Recoil, Graphql, and Typescript. Highlight any deviations.

app/packages/operators/src/state.ts (1)

Pattern **/*.{ts,tsx}: Review the Typescript and React code for conformity with best practices in React, Recoil, Graphql, and Typescript. Highlight any deviations.

app/packages/operators/src/built-in-operators.ts (1)

Pattern **/*.{ts,tsx}: Review the Typescript and React code for conformity with best practices in React, Recoil, Graphql, and Typescript. Highlight any deviations.

⏰ Context from checks skipped due to timeout of 90000ms (7)
  • GitHub Check: test / test-python (ubuntu-latest-m, 3.11)
  • GitHub Check: test / test-python (ubuntu-latest-m, 3.10)
  • GitHub Check: test / test-app
  • GitHub Check: lint / eslint
  • GitHub Check: e2e / test-e2e
  • GitHub Check: build / build
  • GitHub Check: build
🔇 Additional comments (7)
app/packages/operators/src/usePanelEvent.ts (1)

23-23: LGTM! Clean removal of cancellation handling.

The changes consistently remove the cancellation-related functionality while preserving the core event handling logic.

Also applies to: 52-52

app/packages/operators/src/components/OperatorExecutionButton/index.tsx (1)

2-3: LGTM! Clean import statements.

The imports have been properly cleaned up, removing unused dependencies while maintaining TypeScript best practices.

Also applies to: 8-9

app/packages/operators/src/components/OperatorExecutionTrigger/index.tsx (2)

66-84: Well-structured operator execution implementation!

The new implementation:

  • Properly memoizes callbacks using useMemo
  • Cleanly handles operator execution options
  • Maintains type safety

86-89: LGTM! Clean hook usage.

The useOperatorExecutionOptions hook is properly implemented with the required dependencies.

app/packages/core/src/plugins/SchemaIO/components/OperatorExecutionButtonView.tsx (1)

100-101: LGTM! Clean icon positioning implementation.

The icon positioning logic has been simplified using conditional props, which is more idiomatic in React.

app/packages/operators/src/state.ts (1)

659-659: Simplified cancellation handling looks good.

The change aligns with the codebase-wide removal of cancellation handling by directly using the close function.

Let's verify that all usages of the cancel function have been updated:

app/packages/operators/src/built-in-operators.ts (1)

Line range hint 1048-1072: Clean removal of cancellation handling.

The simplified execution flow in PromptUserForOperation correctly maintains the success and error handling while removing the cancellation logic.

Finishing Touches

  • 📝 Generate Docstrings (Beta)

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?

❤️ 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. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @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
Contributor

@imanjra imanjra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

executionParams?: object;
onOptionSelected?: (option: OperatorExecutionOption) => void;
disabled?: boolean;
children: React.ReactNode;
executorOptions?: OperatorExecutorOptions;
}) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at the branch I know works, there is only 1 diff @ritch

It looks like the below code needs to get removed according to the test revert PR: https://github.com/voxel51/fiftyone-teams/pull/1178/files#diff-c7ac05774e1bef71c873704cd12ecb89aea648e19b061d7953b088b5a47766dbL54

onOptionSelected?: (option: OperatorExecutionOption) => void;
disabled?: boolean;
}) => {
const [isMenuOpen, setIsMenuOpen] = useState(false);
// Anchor to use for context menu
const containerRef = useRef(null);

// Pass onSuccess and onError through to the operator executor.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm this is only partially reverting... ugh. Going to close this and start over.

@ritch ritch closed this Jan 17, 2025
@ritch ritch deleted the rever_on_cancel_changes branch January 17, 2025 19:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants