feat: hackathon client configurator - #1930
Merged
Merged
Conversation
daniel-graham-amplitude
marked this pull request as draft
August 12, 2026 02:06
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix prepared fixes for both issues found in the latest run.
- ✅ Fixed: Panels collapse on every re-render
- Panel now omits the open prop unless defaultOpen is true, so details stays uncontrolled across form re-renders.
- ✅ Fixed: Capture rule IDs collide after restore
- decodeStateFromUrl now advances the rule id counter past restored ids via rememberCaptureRuleIds before new rules are created.
Or push these changes by commenting:
@cursor push 8d2d26826e
Preview (8d2d26826e)
diff --git a/test-server/configurator/autocapture-options.js b/test-server/configurator/autocapture-options.js
--- a/test-server/configurator/autocapture-options.js
+++ b/test-server/configurator/autocapture-options.js
@@ -104,6 +104,17 @@
};
}
+// Shared links restore rules with their original ids, so bump the counter past anything already in
+// use before the next createCaptureRule() call.
+export function rememberCaptureRuleIds(rules = []) {
+ for (const rule of rules) {
+ const match = /^rule-(\d+)$/.exec(rule?.id);
+ if (match) {
+ nextRuleId = Math.max(nextRuleId, Number(match[1]));
+ }
+ }
+}
+
const pageUrlAllowlist = {
key: 'pageUrlAllowlist',
label: 'Page URL allowlist',
diff --git a/test-server/configurator/components.jsx b/test-server/configurator/components.jsx
--- a/test-server/configurator/components.jsx
+++ b/test-server/configurator/components.jsx
@@ -193,10 +193,11 @@
}
// Left uncontrolled so the browser owns the open/closed state; the panel re-renders on every
-// keystroke elsewhere on the page and a controlled `open` would fight that.
+// keystroke elsewhere on the page and a controlled `open` would fight that. Only pass `open` when
+// the panel should start open — `open={false}` is still controlled and would slam shut on re-render.
export function Panel({ title, description, badge, defaultOpen = false, children }) {
return (
- <details style={styles.panel} open={defaultOpen}>
+ <details style={styles.panel} {...(defaultOpen ? { open: true } : {})}>
<summary style={styles.panelSummary}>
{title}
{badge ? <span style={styles.panelBadge}>{badge}</span> : null}
diff --git a/test-server/configurator/share-link.js b/test-server/configurator/share-link.js
--- a/test-server/configurator/share-link.js
+++ b/test-server/configurator/share-link.js
@@ -1,3 +1,5 @@
+import { rememberCaptureRuleIds } from './autocapture-options.js';
+
// The form state round-trips through a single query parameter, so a bookmarked URL reopens the same
// configuration.
//
@@ -90,7 +92,9 @@
return defaults;
}
try {
- return mergeOverDefaults(defaults, JSON.parse(await inflate(fromBase64Url(saved))));
+ const state = mergeOverDefaults(defaults, JSON.parse(await inflate(fromBase64Url(saved))));
+ rememberCaptureRuleIds(state.autocaptureSubOptions?.networkTracking?.captureRules);
+ return state;
} catch (error) {
// A truncated or hand-edited link shouldn't leave the page blank.
console.warn(`Ignoring unreadable ?${STATE_PARAM} parameter`, error);You can send follow-ups to the cloud agent here.
Reviewed by Cursor Bugbot for commit 98106e9. Configure here.
size-limit report 📦
|
daniel-graham-amplitude
marked this pull request as ready for review
September 22, 2026 16:58
Mercy811
approved these changes
Sep 22, 2026
… hackathon-client-configurator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Summary
Checklist
Note
Low Risk
Changes are limited to local test-server tooling and a dev dependency; production SDK packages and runtime behavior are unaffected.
Overview
Adds a hackathon-style Browser Client Configurator under
test-server/for building and tryingamplitude.init()setups without hand-editing code.The main page is a React form mapped to analytics, autocapture (including network capture rules), Session Replay, and Guides & Surveys options, with tooltips aligned to SDK JSDoc. It emits ESM, browser snippet, or Unified
initAllcode (only non-default fields), highlights output via Prism (prismjsdevDependency), and supports Copy Link / Run using a compressed?config=query param. The run page loads workspace SDK packages through Vite aliases, initializes plugins in doc order, and logs events from a small sandbox.Vite is updated to register the new HTML entries and scope
@vitejs/plugin-reacttoconfigurator/so other test pages stay unchanged. The iframe sandbox Playwright spec only has formatting tweaks.Reviewed by Cursor Bugbot for commit 173c161. Bugbot is set up for automated code reviews on this repo. Configure here.