From cb602332efa9db4d776c81062fb3dc3fa3cc1d76 Mon Sep 17 00:00:00 2001 From: David Nguyen Date: Wed, 19 Aug 2026 18:07:01 +0700 Subject: [PATCH 1/2] Fix widget score action and restore initial check --- components/arcade/arcade-embed-widget.tsx | 42 ++++++++++++++++++----- 1 file changed, 33 insertions(+), 9 deletions(-) diff --git a/components/arcade/arcade-embed-widget.tsx b/components/arcade/arcade-embed-widget.tsx index 9c4a1e996..46991aca8 100644 --- a/components/arcade/arcade-embed-widget.tsx +++ b/components/arcade/arcade-embed-widget.tsx @@ -9,7 +9,6 @@ import { Sparkles, Trophy, } from "lucide-react" -import type { FormEvent } from "react" import { useCallback, useEffect, useRef, useState } from "react" import { getFacilitatorAdjustedPoints } from "@/components/arcade/facilitator-points" import { @@ -292,6 +291,7 @@ export default function ArcadeEmbedWidget() { ? requestedProfileUrl : readStoredProfileUrl() const tracking = getWidgetTracking(params) + let initialCheckTimer: number | undefined setTrackedUrls({ dashboard: buildTrackedUrl(DEFAULT_DASHBOARD_URL, tracking), @@ -299,20 +299,24 @@ export default function ArcadeEmbedWidget() { firefox: buildTrackedUrl(FIREFOX_EXTENSION_URL, tracking), }) - // Restore the profile and its confirmations, but do not auto-submit. - // The widget now requires an explicit Check score click so users can review - // the Facilitator/Bonus confirmations first and the button never starts locked. if (initialProfileUrl) { const selection = readFacilitatorSelection(initialProfileUrl) setProfileUrl(initialProfileUrl) setParticipating(selection.participating) setBonusMilestoneCompleted(selection.bonusMilestoneCompleted) + + // Run the initial score check after restoring the controls so the widget + // visibly enters its loading state instead of looking unresponsive. + initialCheckTimer = window.setTimeout(() => { + void analyzeProfile(initialProfileUrl, selection) + }, 0) } return () => { + if (initialCheckTimer !== undefined) window.clearTimeout(initialCheckTimer) requestIdRef.current += 1 } - }, []) + }, [analyzeProfile]) const normalizedProfileUrl = normalizeProfileUrl(profileUrl) const hasValidProfileUrl = isValidProfileUrl(normalizedProfileUrl) @@ -367,8 +371,9 @@ export default function ArcadeEmbedWidget() { writeBonusMilestoneCompleted(normalizedProfileUrl, nextCompleted) } - async function checkScore(event: FormEvent) { - event.preventDefault() + async function checkScore() { + if (loading) return + const normalized = normalizeProfileUrl(profileUrl) if (!isValidProfileUrl(normalized)) { @@ -436,7 +441,14 @@ export default function ArcadeEmbedWidget() {

Paste your public Google Skills profile URL to see your latest points and tier.

-
+ { + event.preventDefault() + void checkScore() + }} + noValidate + > - From 26656bb40f74efcab3c5117e689744c686357949 Mon Sep 17 00:00:00 2001 From: David Nguyen Date: Wed, 19 Aug 2026 18:07:24 +0700 Subject: [PATCH 2/2] Update widget score action regression tests --- tests/arcade-bonus-milestone-request.test.mjs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/arcade-bonus-milestone-request.test.mjs b/tests/arcade-bonus-milestone-request.test.mjs index 899ad097e..2f6109470 100644 --- a/tests/arcade-bonus-milestone-request.test.mjs +++ b/tests/arcade-bonus-milestone-request.test.mjs @@ -136,14 +136,14 @@ test("widget requires Facilitator participation and explicit Bonus Milestone con ) }) -test("widget restores saved state without auto-submitting the score request", () => { +test("widget performs an initial check and keeps an explicit clickable score action", () => { assert.match(widgetComponent, /setProfileUrl\(initialProfileUrl\)/) - assert.doesNotMatch( - widgetComponent, - /void analyzeProfile\(initialProfileUrl, selection\)/, - ) assert.match( widgetComponent, - /button\s+type="submit"\s+disabled={loading}/, + /void analyzeProfile\(initialProfileUrl, selection\)/, ) + assert.match(widgetComponent, /async function checkScore\(\)/) + assert.match(widgetComponent, /onClick=\{\(event\) => \{/) + assert.match(widgetComponent, /void checkScore\(\)/) + assert.match(widgetComponent, /event\.key !== "Enter"/) })