Skip to content

more refact#246

Merged
aidenybai merged 4 commits intomainfrom
more-refact
Mar 16, 2026
Merged

more refact#246
aidenybai merged 4 commits intomainfrom
more-refact

Conversation

@aidenybai
Copy link
Copy Markdown
Owner

@aidenybai aidenybai commented Mar 16, 2026

  • fix
  • Refactor: Update constants and component styles for consistency across the application. Replace PANEL_STYLES with "bg-white" in multiple components to standardize appearance.

Note

Medium Risk
Behavior changes to overlay dismissal/positioning and clipboard writes could affect user interactions and copy integrations, though changes are mostly refactors with added e2e coverage for clipboard metadata.

Overview
Standardizes overlay UI behavior and styling by replacing PANEL_STYLES/hardcoded z-indexes with explicit bg-white and Z_INDEX_LABEL, and by centralizing click-outside/Escape (and optional Enter) handling via new registerOverlayDismiss used across menus/prompts.

Simplifies and hardens copy + runtime behavior by removing the Lexical-specific clipboard payload and always writing plain text/HTML plus application/x-react-grab metadata (with new e2e coverage that captures DataTransfer.setData writes), and by centralizing error normalization (normalizeError*) plus a few internal refactors (agent session bounds sync moved into agent manager internals, dropdowns re-measure on viewport changes, and cache invalidation renames/cleanups).

Written by Cursor Bugbot for commit 93f7132. This will update automatically on new commits. Configure here.


Summary by cubic

Standardized overlay UI and styling, simplified clipboard writes with React Grab metadata, and improved dropdown positioning. Also centralized error handling and fixed a small cookie issue.

  • Refactors

    • Added registerOverlayDismiss for consistent menu/prompt dismissal; dropdowns now re-measure on viewport changes and use a unified offscreen state.
    • Replaced PANEL_STYLES with "bg-white" and standardized z-index with Z_INDEX_LABEL; extracted formatRelativeTime and LOGO_SVG.
    • Centralized errors via normalizeError/normalizeErrorMessage; simplified action enabled checks.
    • Clipboard: removed Lexical payload; always write text/HTML plus application/x-react-grab; added e2e helper to capture DataTransfer.setData and a test asserting metadata.
    • Core/util cleanups: renamed clearAllCaches to invalidateInteractionCaches, added OPACITY_CONVERGENCE_THRESHOLD, simplified open-file URL and removed build-open-file-url, and trimmed unused props/types.
  • Bug Fixes

    • Fixed cookie handling.

Written for commit 93f7132. Summary will update on new commits.

…s the application. Replace PANEL_STYLES with "bg-white" in multiple components to standardize appearance.
@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Mar 16, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
react-grab-website Ready Ready Preview, Comment Mar 16, 2026 0:54am

@pullfrog
Copy link
Copy Markdown
Contributor

pullfrog bot commented Mar 16, 2026

Error

agent completed without reporting progress

Pullfrog  | Rerun failed job ➔View workflow run | Triggered by Pullfrogpullfrog.com𝕏

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Mar 16, 2026

Open in StackBlitz

@react-grab/cli

npm i https://pkg.pr.new/aidenybai/react-grab/@react-grab/cli@246

grab

npm i https://pkg.pr.new/aidenybai/react-grab/grab@246

@react-grab/amp

npm i https://pkg.pr.new/aidenybai/react-grab/@react-grab/amp@246

@react-grab/claude-code

npm i https://pkg.pr.new/aidenybai/react-grab/@react-grab/claude-code@246

@react-grab/codex

npm i https://pkg.pr.new/aidenybai/react-grab/@react-grab/codex@246

@react-grab/copilot

npm i https://pkg.pr.new/aidenybai/react-grab/@react-grab/copilot@246

@react-grab/cursor

npm i https://pkg.pr.new/aidenybai/react-grab/@react-grab/cursor@246

@react-grab/droid

npm i https://pkg.pr.new/aidenybai/react-grab/@react-grab/droid@246

@react-grab/gemini

npm i https://pkg.pr.new/aidenybai/react-grab/@react-grab/gemini@246

@react-grab/opencode

npm i https://pkg.pr.new/aidenybai/react-grab/@react-grab/opencode@246

react-grab

npm i https://pkg.pr.new/aidenybai/react-grab@246

@react-grab/relay

npm i https://pkg.pr.new/aidenybai/react-grab/@react-grab/relay@246

@react-grab/utils

npm i https://pkg.pr.new/aidenybai/react-grab/@react-grab/utils@246

commit: 93f7132

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 24 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="packages/react-grab/src/utils/normalize-error.ts">

<violation number="1" location="packages/react-grab/src/utils/normalize-error.ts:5">
P2: Handle string errors before returning the fallback to avoid swallowing custom string errors.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

error: unknown,
fallback = "Unknown error",
): string =>
error instanceof Error && error.message ? error.message : fallback;
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot Mar 16, 2026

Choose a reason for hiding this comment

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

P2: Handle string errors before returning the fallback to avoid swallowing custom string errors.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/react-grab/src/utils/normalize-error.ts, line 5:

<comment>Handle string errors before returning the fallback to avoid swallowing custom string errors.</comment>

<file context>
@@ -0,0 +1,8 @@
+  error: unknown,
+  fallback = "Unknown error",
+): string =>
+  error instanceof Error && error.message ? error.message : fallback;
+
+export const normalizeError = (error: unknown): Error =>
</file context>
Fix with Cubic


const createMentionNode = (
displayName: string,
mentionKey: string,
Copy link
Copy Markdown
Contributor

@vercel vercel bot Mar 16, 2026

Choose a reason for hiding this comment

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

Cursor integration broken due to removal of Lexical editor clipboard format support and mention-based plaintext prefix

Fix on Vercel

…ents for enhanced clarity and maintainability. Adjust event handling in context menus and toolbars to streamline user interactions.
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 18 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="packages/react-grab/src/utils/register-overlay-dismiss.ts">

<violation number="1" location="packages/react-grab/src/utils/register-overlay-dismiss.ts:36">
P2: Use `event.key === "Enter"` to support both the main Enter key and Numpad Enter.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

return;
}

if (event.code === "Enter" && options.onConfirm) {
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot Mar 16, 2026

Choose a reason for hiding this comment

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

P2: Use event.key === "Enter" to support both the main Enter key and Numpad Enter.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/react-grab/src/utils/register-overlay-dismiss.ts, line 36:

<comment>Use `event.key === "Enter"` to support both the main Enter key and Numpad Enter.</comment>

<file context>
@@ -0,0 +1,71 @@
+      return;
+    }
+
+    if (event.code === "Enter" && options.onConfirm) {
+      event.preventDefault();
+      event.stopImmediatePropagation();
</file context>
Fix with Cubic

error: unknown,
fallback = "Unknown error",
): string =>
error instanceof Error && error.message ? error.message : fallback;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
error instanceof Error && error.message ? error.message : fallback;
error instanceof Error && error.message
? error.message
: typeof error === "string"
? error
: fallback;

The normalizeErrorMessage function silently discards string errors, returning the fallback message instead of the actual error string.

Fix on Vercel

@aidenybai aidenybai merged commit 76d6878 into main Mar 16, 2026
16 checks passed
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.

1 participant