Skip to content

feat(react-grab): add silent option to suppress intro log#318

Open
ElminD wants to merge 2 commits into
aidenybai:mainfrom
ElminD:ElminD/silence-log-intro
Open

feat(react-grab): add silent option to suppress intro log#318
ElminD wants to merge 2 commits into
aidenybai:mainfrom
ElminD:ElminD/silence-log-intro

Conversation

@ElminD
Copy link
Copy Markdown

@ElminD ElminD commented Apr 30, 2026

Our sentry sends logs and it would be nice to silence the intro - Elmin

Summary

  • Adds a silent?: boolean option to init() that gates the logIntro() call in packages/react-grab/src/core/index.tsx.
  • Parses the same key from the data-options JSON attribute in get-script-options.ts so it works for the script-tag install path too.
  • Documented on the Options interface in types.ts.

Why

When react-grab is initialized in an app that forwards console output to an error tracker (e.g. Sentry breadcrumbs), the intro banner and the follow-up version-check log get pushed upstream every page load. There's currently no way to opt out without monkey-patching console.log. This adds a single, explicit knob.

Usage

import { init } from "react-grab";
init({ silent: true });

Or via script tag:

<script src="..." data-options='{"silent":true}'></script>

Default is false, so existing consumers see no change.

Test plan

  • pnpm --filter react-grab typecheck
  • pnpm lint
  • Manually verify that init({ silent: true }) produces no console output, and init() (or init({ silent: false })) still logs the banner + performs the version check.

🤖 Generated with Claude Code


Note

Low Risk
Low risk: adds an opt-in flag that only gates console/banner output and the version-check log, with no functional changes to selection/copy behavior.

Overview
Adds a new silent?: boolean init-only option to suppress React Grab’s startup banner and version-check logging (including when configured via script tag data-options).

Updates public types so silent cannot be changed via setOptions, and ships a minor version bump via a changeset.

Reviewed by Cursor Bugbot for commit 17ad710. Bugbot is set up for automated code reviews on this repo. Configure here.

Lets consumers opt out of the intro banner and version-check
console.log so it isn't picked up by tools like Sentry that
forward console output as breadcrumbs.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Apr 30, 2026

Someone is attempting to deploy a commit to the Million Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit c931024. Configure here.

Comment thread packages/react-grab/src/types.ts
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 4 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/types.ts">

<violation number="1" location="packages/react-grab/src/types.ts:261">
P2: `silent` is init-only but `SettableOptions extends Options` exposes it on `api.setOptions()`. Add a `silent?: never` override in `SettableOptions` (matching the existing pattern for `enabled`) so TypeScript rejects the no-op call.</violation>
</file>

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

Comment thread packages/react-grab/src/types.ts
Comment thread packages/react-grab/src/types.ts
`silent` is consumed during `init()` and has no effect at runtime, so
exposing it on `api.setOptions()` would type-check as a no-op. Override
it as `never` in `SettableOptions` to match the existing `enabled`
pattern, and strip it alongside `enabled` before forwarding to the
plugin registry.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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