Skip to content

chore(repo): add react-grab to clerk-js sandbox#8666

Merged
jacekradko merged 7 commits into
mainfrom
kylemac/add-react-grab-sandbox
May 27, 2026
Merged

chore(repo): add react-grab to clerk-js sandbox#8666
jacekradko merged 7 commits into
mainfrom
kylemac/add-react-grab-sandbox

Conversation

@kylemac

@kylemac kylemac commented May 27, 2026

Copy link
Copy Markdown
Contributor

Description

Adds react-grab to the clerk-js sandbox so component locations can be jumped to from the rendered Clerk UI during local development. Installed as a devDependency on @clerk/clerk-js and loaded in sandbox/template.html via the unpkg global script. The sandbox has no production build (only pnpm dev:sandbox), so the tag is intrinsically development-only.

To test, run pnpm dev:sandbox, open http://localhost:4000, and use the default React Grab activation key on any rendered Clerk component.

Checklist

  • `pnpm test` runs as expected.
  • `pnpm build` runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

Loads react-grab from unpkg in the sandbox template so component
locations can be inspected during local development. The sandbox has
no production build, so the script is intrinsically dev-only.
@vercel

vercel Bot commented May 27, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
clerk-js-sandbox Ready Ready Preview, Comment May 27, 2026 6:02pm

Request Review

@changeset-bot

changeset-bot Bot commented May 27, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 2b8d4cb

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 0 packages

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai

coderabbitai Bot commented May 27, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

This PR updates the clerk-js sandbox template and runtime: adjusts root/head theme variables, initializes and persists a sidebar-collapsed state via localStorage with desktop slide/transition and mobile visibility CSS, loads a dev react-grab script, refactors navigation into updated nav-link and new nav-group custom elements, adds desktop expand/collapse controls, and updates sandbox app appearance/variables initialization and reset. It also adds three new changeset markdown files.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • clerk/javascript#8605: Both PRs modify packages/clerk-js/sandbox/template.html to rework the sidebar, custom navigation elements, and localStorage-driven UI state management.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'chore(repo): add react-grab to clerk-js sandbox' is specific and directly related to the main change: adding react-grab to the sandbox environment.
Description check ✅ Passed The description is clearly related to the changeset, providing context about adding react-grab to the clerk-js sandbox for local development and testing instructions.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 1

🧹 Nitpick comments (1)
packages/clerk-js/sandbox/template.html (1)

39-43: ⚡ Quick win

Please add a sandbox test for the React Grab integration path.

No tests were added/updated in this PR. A small integration assertion that the sandbox loads with the React Grab script present would cover this change.

As per coding guidelines "**/*: If there are no tests added or modified as part of the PR, please suggest that tests be added to cover the changes."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/clerk-js/sandbox/template.html` around lines 39 - 43, Add an
integration test that starts the sandbox (the dev:sandbox template) and asserts
the rendered HTML contains the React Grab script tag
(src="//unpkg.com/react-grab/dist/index.global.js" and crossorigin="anonymous");
locate the sandbox template referenced by the template.html change and create a
test (e.g., "sandbox.react-grab.spec") that requests the sandbox page or loads
the built template and checks for a script element with that src and attribute
so this change is covered by CI.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/clerk-js/sandbox/template.html`:
- Around line 39-43: Update the protocol-relative, unversioned CDN import in the
sandbox template to an explicit HTTPS URL with a fixed version by replacing the
script src in packages/clerk-js/sandbox/template.html with
https://unpkg.com/react-grab@0.1.37/dist/index.global.js; then add a
sandbox/integration test that boots the dev sandbox and asserts the global
ReactGrab is present (e.g., a test that loads the template and checks
window.ReactGrab or similar), ensuring the test verifies the sandbox wiring for
the React Grab script.

---

Nitpick comments:
In `@packages/clerk-js/sandbox/template.html`:
- Around line 39-43: Add an integration test that starts the sandbox (the
dev:sandbox template) and asserts the rendered HTML contains the React Grab
script tag (src="//unpkg.com/react-grab/dist/index.global.js" and
crossorigin="anonymous"); locate the sandbox template referenced by the
template.html change and create a test (e.g., "sandbox.react-grab.spec") that
requests the sandbox page or loads the built template and checks for a script
element with that src and attribute so this change is covered by CI.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 27a23de7-ca4c-4370-bbf1-6d5c48e52672

📥 Commits

Reviewing files that changed from the base of the PR and between 51344b0 and 46f3fa2.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (3)
  • .changeset/old-months-grow.md
  • packages/clerk-js/package.json
  • packages/clerk-js/sandbox/template.html

Comment on lines +39 to +43
<!-- React Grab (development-only: this template is only used by `pnpm dev:sandbox`) -->
<script
src="//unpkg.com/react-grab/dist/index.global.js"
crossorigin="anonymous"
></script>

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.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify current dependency declaration vs sandbox CDN URL
jq -r '.devDependencies["react-grab"]' packages/clerk-js/package.json
rg -n "react-grab|unpkg.com/react-grab" packages/clerk-js/sandbox/template.html

Repository: clerk/javascript

Length of output: 127


🏁 Script executed:

#!/bin/bash
# 1) Check what files changed (and whether any test-related files are among them)
echo "=== Changed files ==="
git diff --name-only

echo
echo "=== Changed test-related files ==="
git diff --name-only | rg -n -i '(^|/)(test|__tests__|tests|spec|cypress|playwright)/|\.test\.(js|ts|tsx|jsx)$|\.spec\.(js|ts|tsx|jsx)$' || true

echo
# 2) Confirm all unpkg references in the template
echo "=== unpkg.com references in template.html ==="
rg -n "unpkg\.com" packages/clerk-js/sandbox/template.html || true

echo
# 3) Show surrounding context for the snippet
echo "=== Context around CDN script tag ==="
sed -n '25,60p' packages/clerk-js/sandbox/template.html

Repository: clerk/javascript

Length of output: 1728


Pin the React Grab CDN script URL (explicit HTTPS + version) and add sandbox test coverage.

  • packages/clerk-js/sandbox/template.html loads //unpkg.com/react-grab/dist/index.global.js (protocol-relative, unversioned); pin to an explicit https://unpkg.com/react-grab@0.1.37/dist/index.global.js (or another exact version).
  • No tests were added/modified in this PR scope; add an integration/sandbox test that asserts React Grab loads correctly and sandbox wiring works.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/clerk-js/sandbox/template.html` around lines 39 - 43, Update the
protocol-relative, unversioned CDN import in the sandbox template to an explicit
HTTPS URL with a fixed version by replacing the script src in
packages/clerk-js/sandbox/template.html with
https://unpkg.com/react-grab@0.1.37/dist/index.global.js; then add a
sandbox/integration test that boots the dev sandbox and asserts the global
ReactGrab is present (e.g., a test that loads the template and checks
window.ReactGrab or similar), ensuring the test verifies the sandbox wiring for
the React Grab script.

@pkg-pr-new

pkg-pr-new Bot commented May 27, 2026

Copy link
Copy Markdown

Open in StackBlitz

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@8666

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@8666

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@8666

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@8666

@clerk/dev-cli

npm i https://pkg.pr.new/@clerk/dev-cli@8666

@clerk/expo

npm i https://pkg.pr.new/@clerk/expo@8666

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@8666

@clerk/express

npm i https://pkg.pr.new/@clerk/express@8666

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@8666

@clerk/hono

npm i https://pkg.pr.new/@clerk/hono@8666

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@8666

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@8666

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@8666

@clerk/react

npm i https://pkg.pr.new/@clerk/react@8666

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@8666

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@8666

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@8666

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@8666

@clerk/ui

npm i https://pkg.pr.new/@clerk/ui@8666

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@8666

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@8666

commit: 2466bd7

@kylemac kylemac requested a review from a team May 27, 2026 16:44
Comment thread packages/clerk-js/package.json Outdated
"bundlewatch": "^0.4.2",
"jsdom": "26.1.0",
"minimatch": "^10.2.5",
"react-grab": "^0.1.37",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

since your loading from unpkg, whats the reason for needing it as devDependencies?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

no probably not. i didn't catch that. i'll remove from dev dep

The sandbox loads react-grab as a global script from unpkg in
template.html, so the npm package isn't imported anywhere. Removing
the devDependency also drops its transitive tree (bippy, ora, etc.)
from the lockfile.
@github-actions

Copy link
Copy Markdown
Contributor

Snapi: no API changes detected in @clerk/backend, @clerk/clerk-js, @clerk/nextjs, @clerk/react, @clerk/shared, @clerk/ui.

@kylemac kylemac requested a review from alexcarpenter May 27, 2026 17:15

@coderabbitai coderabbitai Bot left a comment

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.

🧹 Nitpick comments (1)
packages/clerk-js/sandbox/template.html (1)

291-311: ⚡ Quick win

Add test coverage for sidebar collapsed-state persistence.

This PR adds behavior (localStorage read/write + data-sidebar-collapsed toggling) but no tests were added/updated. Please add a sandbox-focused test that verifies initial state hydration from storage and collapse/expand state persistence.

As per coding guidelines, **/*: "If there are no tests added or modified as part of the PR, please suggest that tests be added to cover the changes."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/clerk-js/sandbox/template.html` around lines 291 - 311, Add
sandbox-focused tests that cover the new sidebar collapsed-state persistence:
write tests that (1) set localStorage[STORAGE_KEY] before DOMContentLoaded and
assert that the HTML element has the data-sidebar-collapsed attribute after the
page/script initializes (hydration), and (2) simulate clicks on the elements
with IDs 'sidebarCollapse' and 'sidebarExpandBtn' and assert localStorage
changes and that setCollapsed correctly toggles the data-sidebar-collapsed
attribute. Reference the STORAGE_KEY constant and the setCollapsed function (and
the click targets 'sidebarCollapse' and 'sidebarExpandBtn') when locating
behavior to test; reset/cleanup localStorage and DOM between tests.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@packages/clerk-js/sandbox/template.html`:
- Around line 291-311: Add sandbox-focused tests that cover the new sidebar
collapsed-state persistence: write tests that (1) set localStorage[STORAGE_KEY]
before DOMContentLoaded and assert that the HTML element has the
data-sidebar-collapsed attribute after the page/script initializes (hydration),
and (2) simulate clicks on the elements with IDs 'sidebarCollapse' and
'sidebarExpandBtn' and assert localStorage changes and that setCollapsed
correctly toggles the data-sidebar-collapsed attribute. Reference the
STORAGE_KEY constant and the setCollapsed function (and the click targets
'sidebarCollapse' and 'sidebarExpandBtn') when locating behavior to test;
reset/cleanup localStorage and DOM between tests.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: b55de652-09da-4e74-9141-e20821343645

📥 Commits

Reviewing files that changed from the base of the PR and between 46f3fa2 and 739f3cc.

📒 Files selected for processing (2)
  • .changeset/sandbox-sidebar-refresh.md
  • packages/clerk-js/sandbox/template.html
✅ Files skipped from review due to trivial changes (1)
  • .changeset/sandbox-sidebar-refresh.md

@alexcarpenter alexcarpenter changed the title chore(js): add react-grab to clerk-js sandbox chore(repo): add react-grab to clerk-js sandbox May 27, 2026
Co-authored-by: Kyle MacDonald <kyle@clerk.dev>
@jacekradko jacekradko merged commit 9cbf090 into main May 27, 2026
42 of 43 checks passed
@jacekradko jacekradko deleted the kylemac/add-react-grab-sandbox branch May 27, 2026 18:04
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.

3 participants