Skip to content

refactor: fontSizeSelector fieldType#1153

Merged
mkilpatrick merged 19 commits intomainfrom
font-size-selector-field
Apr 13, 2026
Merged

refactor: fontSizeSelector fieldType#1153
mkilpatrick merged 19 commits intomainfrom
font-size-selector-field

Conversation

@mkilpatrick
Copy link
Copy Markdown
Collaborator

@mkilpatrick mkilpatrick commented Apr 10, 2026

Makes fontSizeSelector a real fieldType.

Also refactors some tests so that they are less flaky/cause infinite loops.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 10, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Refactors FontSizeSelector into a typed field API: adds FontSizeSelectorField type and FontSizeSelectorFieldOverride component, removes the prior function export and its barrel re-export, adds a fields barrel and re-exports it from package root, and updates field registrations. Adds comprehensive font-size tests (and removes the prior unit test file). Introduces test utilities and env detection, stabilizes screenshot capture and comparison (width+height), alters Locator to short-circuit to a test placeholder when in the visual-editor test env, and makes NearbyLocations sorting deterministic with a stable tie-breaker. Minor import ordering fix in a docs d.ts.

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant LocatorComponent
  participant isVisualEditorTestEnv
  participant MapboxMap

  Client->>LocatorComponent: render()
  LocatorComponent->>isVisualEditorTestEnv: isVisualEditorTestEnv()
  alt test env true
    LocatorComponent->>Client: render LocatorTestMap (placeholder)
  else test env false
    LocatorComponent->>MapboxMap: initialize / load
    MapboxMap-->>LocatorComponent: ready
    LocatorComponent->>Client: render Mapbox map UI
  end
Loading

Possibly related PRs

Suggested labels

create-dev-release

Suggested reviewers

  • briantstephan
  • jwartofsky-yext
  • benlife5
🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'refactor: fontSizeSelector fieldType' clearly and concisely summarizes the main architectural change in the PR, making fontSizeSelector a proper field type.
Description check ✅ Passed The description directly relates to the changeset, mentioning the conversion of fontSizeSelector to a real fieldType and test refactoring for stability.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch font-size-selector-field

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/visual-editor/src/fields/FontSizeSelectorField.tsx (1)

34-45: ⚠️ Potential issue | 🟠 Major

Check both theme.fontSize and theme.extend.fontSize, and handle conversion failures gracefully.

The function only reads from theme.extend.fontSize, missing projects that override theme.fontSize directly. Additionally, convertToPixels() throws on unsupported units (anything other than px, rem, em, %). Valid Tailwind/CSS values like clamp() or CSS variables will cause runtime errors and break the field renderer instead of falling back gracefully. Read from both config locations and wrap the conversion in a try-catch to return 0 on failure.

Possible fix
 export const getCustomFontSize = (
   tailwindConfig: TailwindConfig,
   value: string
 ): number => {
-  const customFontSize = tailwindConfig?.theme?.extend?.fontSize?.[value];
+  const customFontSize =
+    tailwindConfig?.theme?.extend?.fontSize?.[value] ??
+    tailwindConfig?.theme?.fontSize?.[value];
+
+  const toPixelsOrZero = (fontSize: string) => {
+    try {
+      return convertToPixels(fontSize);
+    } catch {
+      return 0;
+    }
+  };
+
   if (typeof customFontSize === "string") {
-    return convertToPixels(customFontSize);
+    return toPixelsOrZero(customFontSize);
   }
   if (Array.isArray(customFontSize) && customFontSize.length > 0) {
-    return convertToPixels(customFontSize[0]);
+    return toPixelsOrZero(customFontSize[0]);
   }
   return 0;
 };
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/visual-editor/src/fields/FontSizeSelectorField.tsx` around lines 34
- 45, Update getCustomFontSize to check both tailwindConfig.theme.fontSize and
tailwindConfig.theme.extend.fontSize for the key (falling back from extend to
base), and guard the convertToPixels call with a try-catch so any conversion
error returns 0 instead of throwing; specifically, in getCustomFontSize locate
customFontSize by first checking theme?.fontSize?.[value] then
theme?.extend?.fontSize?.[value], handle both string and array cases as before,
and wrap the convertToPixels(...) invocations in try/catch to return 0 on
failure.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@packages/visual-editor/src/fields/FontSizeSelectorField.tsx`:
- Around line 34-45: Update getCustomFontSize to check both
tailwindConfig.theme.fontSize and tailwindConfig.theme.extend.fontSize for the
key (falling back from extend to base), and guard the convertToPixels call with
a try-catch so any conversion error returns 0 instead of throwing; specifically,
in getCustomFontSize locate customFontSize by first checking
theme?.fontSize?.[value] then theme?.extend?.fontSize?.[value], handle both
string and array cases as before, and wrap the convertToPixels(...) invocations
in try/catch to return 0 on failure.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: b551bd1c-b461-4bda-bd34-8ae56a2af08a

📥 Commits

Reviewing files that changed from the base of the PR and between 3d81b12 and e462043.

📒 Files selected for processing (8)
  • packages/visual-editor/src/docs/ai/components.d.ts
  • packages/visual-editor/src/editor/FontSizeSelector.test.ts
  • packages/visual-editor/src/editor/index.ts
  • packages/visual-editor/src/fields/FontSizeSelectorField.test.tsx
  • packages/visual-editor/src/fields/FontSizeSelectorField.tsx
  • packages/visual-editor/src/fields/fields.ts
  • packages/visual-editor/src/fields/index.ts
  • packages/visual-editor/src/index.ts
💤 Files with no reviewable changes (2)
  • packages/visual-editor/src/editor/index.ts
  • packages/visual-editor/src/editor/FontSizeSelector.test.ts

Comment thread packages/visual-editor/src/fields/FontSizeSelectorField.tsx
briantstephan
briantstephan previously approved these changes Apr 10, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Warning: Component files have been updated but no migrations have been added. See https://github.com/yext/visual-editor/blob/main/packages/visual-editor/src/components/migrations/README.md for more information.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
packages/visual-editor/src/fields/FontSizeSelectorField.tsx (1)

43-49: ⚠️ Potential issue | 🟡 Minor

Guard tuple font-size values before pixel conversion.

Line 48 assumes customFontSize[0] is always a string. If that tuple is misconfigured, convertToPixels can throw at runtime. Add a type guard before conversion.

Proposed fix
   if (typeof customFontSize === "string") {
     return convertToPixels(customFontSize);
   }
-  if (Array.isArray(customFontSize) && customFontSize.length > 0) {
+  if (
+    Array.isArray(customFontSize) &&
+    customFontSize.length > 0 &&
+    typeof customFontSize[0] === "string"
+  ) {
     return convertToPixels(customFontSize[0]);
   }
   return 0;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/visual-editor/src/fields/FontSizeSelectorField.tsx` around lines 43
- 49, The tuple branch in FontSizeSelectorField.tsx assumes customFontSize[0] is
a string and calls convertToPixels directly; add a guard that checks
Array.isArray(customFontSize) && customFontSize.length > 0 && typeof
customFontSize[0] === "string" before calling convertToPixels(customFontSize[0])
and handle the non-string case (e.g., skip conversion or return a safe
default/undefined) so convertToPixels is never invoked with a non-string.
packages/visual-editor/src/components/testing/compareScreenshot.ts (1)

37-40: ⚠️ Potential issue | 🔴 Critical

Return type mismatch breaks caller destructuring.

The baseline creation path returns { pass, message } but the declared interface in componentTests.d.ts expects { passes: boolean; numDiffPixels: number }. The caller in componentTests.setup.ts destructures { passes, numDiffPixels }, so this path will yield undefined for both fields.

🐛 Proposed fix
   } catch (_) {
     // If baseline doesn't exist, save new screenshot as baseline
     mkdirSync(path.dirname(filePath), { recursive: true });
     writeFileSync(filePath, PNG.sync.write(updatedImg));
     return {
-      pass: false,
-      message: () => `Baseline screenshot created for ${filePath}`,
+      passes: false,
+      numDiffPixels: 0,
     };
   }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/visual-editor/src/components/testing/compareScreenshot.ts` around
lines 37 - 40, The baseline creation branch in compareScreenshot currently
returns { pass, message } which doesn't match the expected interface from
componentTests.d.ts and breaks the destructuring in componentTests.setup.ts;
update the return value in the baseline path of the compareScreenshot function
to return the shape { passes: boolean, numDiffPixels: number } (set passes to
true/false as appropriate and numDiffPixels to 0 for a newly-created baseline)
so callers that destructure { passes, numDiffPixels } receive the correct
fields.
🧹 Nitpick comments (3)
packages/visual-editor/src/components/pageSections/NearbyLocations/utils.ts (1)

181-196: Precompute stable sort keys once to reduce comparator overhead.

getDocStableSortKey is currently recomputed on each comparison. You can compute it once during .map(...) and reuse it in .sort(...).

♻️ Suggested refactor
   const nearestDocs = allDocs
     .map((doc) => {
       const coordinate = getDocCoordinate(doc);
       return {
         doc,
         distance: coordinate ? getDistance(origin, coordinate) : Infinity,
+        stableSortKey: getDocStableSortKey(doc),
       };
     })
     .sort((a, b) => {
       if (a.distance !== b.distance) {
         return a.distance - b.distance;
       }

-      return getDocStableSortKey(a.doc).localeCompare(
-        getDocStableSortKey(b.doc)
-      );
+      return a.stableSortKey.localeCompare(b.stableSortKey);
     })

Also applies to: 228-230

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/visual-editor/src/components/pageSections/NearbyLocations/utils.ts`
around lines 181 - 196, The comparator calls getDocStableSortKey repeatedly;
compute the stable key once in the .map step by adding a stableKey property
(e.g. compute getDocStableSortKey(doc) alongside doc and distance) and then
update the .sort to compare using that precomputed stableKey instead of calling
getDocStableSortKey again; apply the same change to the other occurrence
referenced (lines ~228-230) so both sorts use the cached stableKey.
packages/visual-editor/src/components/testing/componentTests.setup.ts (1)

89-118: Stability helpers improve screenshot consistency.

The two-frame wait per iteration and font readiness check are appropriate for reducing flakiness. However, the loop exits silently after 5 attempts even if metrics never stabilized, which could mask timing issues during debugging.

💡 Optional: Log warning when stability check exhausts attempts
   for (let attempt = 0; attempt < 5; attempt++) {
     await waitForNextFrame();
     await waitForNextFrame();

     const metrics = [
       document.body.scrollWidth,
       document.body.scrollHeight,
       document.body.offsetWidth,
       document.body.offsetHeight,
     ].join(":");

     if (metrics === previousMetrics) {
       return;
     }

     previousMetrics = metrics;
   }
+
+  console.warn(
+    "waitForStableScreenshotFrame: layout did not stabilize after 5 attempts"
+  );
 };
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/visual-editor/src/components/testing/componentTests.setup.ts` around
lines 89 - 118, The waitForStableScreenshotFrame helper silently returns after 5
unsuccessful attempts to stabilize metrics, which can hide timing problems;
update waitForStableScreenshotFrame to emit a warning (e.g., using console.warn
or the test logger) when the loop exhausts attempts without metrics stabilizing,
include identifying context (function name waitForStableScreenshotFrame, the
metrics string and number of attempts), and retain the existing font readiness
and two-frame wait via waitForNextFrame so behavior is unchanged except for the
new warning when stability is not reached.
packages/visual-editor/src/components/contentBlocks/MapboxStaticMap.tsx (1)

75-114: Consider extracting shared test helpers.

isVisualEditorTestEnv() and getStaticMapPreviewBackground() are duplicated in Locator.tsx (as isVisualEditorTestEnv and getLocatorTestMapBackground). The formatMapStyleLabel implementations differ slightly (this version doesn't handle the mapbox://styles/mapbox/ prefix that Locator's version strips with .split("/").pop()).

Extracting these to a shared utility would reduce duplication and ensure consistent behavior.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/visual-editor/src/components/contentBlocks/MapboxStaticMap.tsx`
around lines 75 - 114, The two helpers isVisualEditorTestEnv and
getStaticMapPreviewBackground and the similar helpers in Locator.tsx
(isVisualEditorTestEnv, getLocatorTestMapBackground) plus the slightly different
formatMapStyleLabel should be extracted into a shared utility module; create a
single exported util (e.g., formatMapStyleLabel, isVisualEditorTestEnv,
getStaticMapPreviewBackground) that also normalizes Mapbox style strings by
stripping a "mapbox://styles/.../" prefix (use .split("/").pop()) before
applying the existing regex/replace logic, move the implementations there, and
update MapboxStaticMap.tsx and Locator.tsx to import and use these shared
functions so both files share identical behavior and avoid duplication.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/visual-editor/src/components/Locator.tsx`:
- Around line 1102-1122: Remove the unnecessary nullish coalescing using
result.id when generating React keys inside the results.slice map in
Locator.tsx: always use the deterministic `${result.index}-${index}` key
(referencing the map over results.slice(0, TEST_MAP_PIN_POSITIONS.length) and
the MapPinIcon render) so replace the key expression to consistently use
result.index and index, ensuring stable, unique keys for reconciliation.

---

Outside diff comments:
In `@packages/visual-editor/src/components/testing/compareScreenshot.ts`:
- Around line 37-40: The baseline creation branch in compareScreenshot currently
returns { pass, message } which doesn't match the expected interface from
componentTests.d.ts and breaks the destructuring in componentTests.setup.ts;
update the return value in the baseline path of the compareScreenshot function
to return the shape { passes: boolean, numDiffPixels: number } (set passes to
true/false as appropriate and numDiffPixels to 0 for a newly-created baseline)
so callers that destructure { passes, numDiffPixels } receive the correct
fields.

In `@packages/visual-editor/src/fields/FontSizeSelectorField.tsx`:
- Around line 43-49: The tuple branch in FontSizeSelectorField.tsx assumes
customFontSize[0] is a string and calls convertToPixels directly; add a guard
that checks Array.isArray(customFontSize) && customFontSize.length > 0 && typeof
customFontSize[0] === "string" before calling convertToPixels(customFontSize[0])
and handle the non-string case (e.g., skip conversion or return a safe
default/undefined) so convertToPixels is never invoked with a non-string.

---

Nitpick comments:
In `@packages/visual-editor/src/components/contentBlocks/MapboxStaticMap.tsx`:
- Around line 75-114: The two helpers isVisualEditorTestEnv and
getStaticMapPreviewBackground and the similar helpers in Locator.tsx
(isVisualEditorTestEnv, getLocatorTestMapBackground) plus the slightly different
formatMapStyleLabel should be extracted into a shared utility module; create a
single exported util (e.g., formatMapStyleLabel, isVisualEditorTestEnv,
getStaticMapPreviewBackground) that also normalizes Mapbox style strings by
stripping a "mapbox://styles/.../" prefix (use .split("/").pop()) before
applying the existing regex/replace logic, move the implementations there, and
update MapboxStaticMap.tsx and Locator.tsx to import and use these shared
functions so both files share identical behavior and avoid duplication.

In `@packages/visual-editor/src/components/pageSections/NearbyLocations/utils.ts`:
- Around line 181-196: The comparator calls getDocStableSortKey repeatedly;
compute the stable key once in the .map step by adding a stableKey property
(e.g. compute getDocStableSortKey(doc) alongside doc and distance) and then
update the .sort to compare using that precomputed stableKey instead of calling
getDocStableSortKey again; apply the same change to the other occurrence
referenced (lines ~228-230) so both sorts use the cached stableKey.

In `@packages/visual-editor/src/components/testing/componentTests.setup.ts`:
- Around line 89-118: The waitForStableScreenshotFrame helper silently returns
after 5 unsuccessful attempts to stabilize metrics, which can hide timing
problems; update waitForStableScreenshotFrame to emit a warning (e.g., using
console.warn or the test logger) when the loop exhausts attempts without metrics
stabilizing, include identifying context (function name
waitForStableScreenshotFrame, the metrics string and number of attempts), and
retain the existing font readiness and two-frame wait via waitForNextFrame so
behavior is unchanged except for the new warning when stability is not reached.
🪄 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 UI

Review profile: CHILL

Plan: Pro

Run ID: ecf17bd6-f9bd-49a6-8b3e-25b7cfcdf1e3

📥 Commits

Reviewing files that changed from the base of the PR and between e462043 and 16624c0.

⛔ Files ignored due to path filters (39)
  • packages/visual-editor/src/components/testing/screenshots/Locator/[desktop] latest version default props.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[desktop] latest version multi-pageset default props.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[desktop] latest version non-default props.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[desktop] version 24 with filters (after interactions).png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[desktop] version 24 with filters.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[desktop] version 60 custom heading with site color 2.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[desktop] version 60 custom heading.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[desktop] version 60 custom title and result cards with site color 3.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[desktop] version 64 static headings (after interactions).png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[desktop] version 64 static headings.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[desktop] version 64 static image.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[mobile] latest version default props.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[mobile] latest version multi-pageset default props.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[mobile] latest version non-default props.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[mobile] version 24 with filters (after interactions).png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[mobile] version 24 with filters.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[mobile] version 60 custom heading with site color 2.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[mobile] version 60 custom heading.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[mobile] version 60 custom title and result cards with site color 3.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[mobile] version 64 static headings (after interactions).png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[mobile] version 64 static headings.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[mobile] version 64 static image.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[tablet] latest version default props.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[tablet] latest version multi-pageset default props.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[tablet] latest version non-default props.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[tablet] version 24 with filters (after interactions).png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[tablet] version 24 with filters.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[tablet] version 60 custom heading with site color 2.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[tablet] version 60 custom heading.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[tablet] version 60 custom title and result cards with site color 3.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[tablet] version 64 static headings (after interactions).png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[tablet] version 64 static headings.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[tablet] version 64 static image.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/StaticMapSection/[desktop] default props with coordinate - with api key.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/StaticMapSection/[desktop] version 10 props with coordinate - with api key.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/StaticMapSection/[mobile] default props with coordinate - with api key.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/StaticMapSection/[mobile] version 10 props with coordinate - with api key.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/StaticMapSection/[tablet] default props with coordinate - with api key.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/StaticMapSection/[tablet] version 10 props with coordinate - with api key.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
📒 Files selected for processing (11)
  • .github/workflows/unit_test.yml
  • packages/visual-editor/src/components/Locator.test.tsx
  • packages/visual-editor/src/components/Locator.tsx
  • packages/visual-editor/src/components/contentBlocks/MapboxStaticMap.tsx
  • packages/visual-editor/src/components/pageSections/NearbyLocations/utils.test.ts
  • packages/visual-editor/src/components/pageSections/NearbyLocations/utils.ts
  • packages/visual-editor/src/components/pageSections/StaticMapSection.test.tsx
  • packages/visual-editor/src/components/testing/compareScreenshot.ts
  • packages/visual-editor/src/components/testing/componentTests.css
  • packages/visual-editor/src/components/testing/componentTests.setup.ts
  • packages/visual-editor/src/fields/FontSizeSelectorField.tsx
✅ Files skipped from review due to trivial changes (1)
  • packages/visual-editor/src/components/testing/componentTests.css

Comment thread packages/visual-editor/src/components/Locator.tsx Outdated
briantstephan
briantstephan previously approved these changes Apr 10, 2026
Comment thread packages/visual-editor/src/components/contentBlocks/MapboxStaticMap.tsx Outdated
Comment thread packages/visual-editor/src/components/Locator.tsx Outdated
Comment thread packages/visual-editor/src/components/Locator.tsx Outdated
Comment thread packages/visual-editor/src/components/contentBlocks/MapboxStaticMap.tsx Outdated
Comment thread packages/visual-editor/src/fields/FontSizeSelectorField.tsx
asanehisa
asanehisa previously approved these changes Apr 13, 2026
Comment thread packages/visual-editor/src/index.ts
Comment thread packages/visual-editor/src/components/Locator.test.tsx Outdated
Copy link
Copy Markdown
Contributor

@jwartofsky-yext jwartofsky-yext left a comment

Choose a reason for hiding this comment

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

looks good, but it seems like this should be two PRs:

  1. FontSizeSelector Field Type

  2. Screenshot Refactor

Comment thread .github/workflows/unit_test.yml
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/visual-editor/src/components/Locator.test.tsx`:
- Around line 104-109: The test fixture's headshot object uses url: "" which
only exercises the empty/broken-image path; update the shared locator fixture
and the static-image test case (the headshot field used in Locator.test.tsx) to
set a tiny data URL (e.g., a 1x1 PNG/SVG data URI) instead of an empty string so
the image rendering path is exercised without network access; locate the
fixtures referenced by the test (the headshot object in the static-image case
and the shared locator fixture) and replace url: "" with the small data URI in
both places.
🪄 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 UI

Review profile: CHILL

Plan: Pro

Run ID: 6767c6a0-5729-43f3-ac55-302ef818d273

📥 Commits

Reviewing files that changed from the base of the PR and between f5f0136 and 397bfb9.

⛔ Files ignored due to path filters (24)
  • packages/visual-editor/src/components/testing/screenshots/Locator/[desktop] latest version default props.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[desktop] latest version multi-pageset default props.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[desktop] latest version non-default props.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[desktop] version 24 with filters (after interactions).png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[desktop] version 24 with filters.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[desktop] version 60 custom heading with site color 2.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[desktop] version 60 custom heading.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[desktop] version 60 custom title and result cards with site color 3.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[desktop] version 64 static headings (after interactions).png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[desktop] version 64 static headings.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[desktop] version 64 static image.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[mobile] version 24 with filters (after interactions).png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[mobile] version 64 static headings (after interactions).png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[tablet] latest version default props.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[tablet] latest version multi-pageset default props.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[tablet] latest version non-default props.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[tablet] version 24 with filters (after interactions).png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[tablet] version 24 with filters.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[tablet] version 60 custom heading with site color 2.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[tablet] version 60 custom heading.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[tablet] version 60 custom title and result cards with site color 3.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[tablet] version 64 static headings (after interactions).png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[tablet] version 64 static headings.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[tablet] version 64 static image.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
📒 Files selected for processing (2)
  • packages/visual-editor/src/components/Locator.test.tsx
  • packages/visual-editor/src/components/Locator.tsx

Comment thread packages/visual-editor/src/components/Locator.test.tsx
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
packages/visual-editor/src/components/Locator.test.tsx (1)

270-273: Derive fixture mode from the locator config, not raw truthiness.

Any non-empty __.locatorSourcePageSets value selects the multi-pageset fixture here, so a malformed document can silently take the happy path instead of matching the component’s real branching. Keying this off parsed _pageset.typeConfig.locatorConfig.sources vs. source would keep the helper aligned with production behavior.

Based on learnings, __.locatorSourcePageSets and __.sourceEntityPageSetTemplate are mutually exclusive, and if both are present the correct behavior is to treat that as an error state rather than a usable multi-pageset config.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/visual-editor/src/components/Locator.test.tsx` around lines 270 -
273, Update getLocatorFixtureResults to determine fixture mode from the parsed
locator config rather than raw truthiness: inspect
document._pageset?.typeConfig?.locatorConfig?.sources and whether that
represents a multi-pageset (vs a single source) to choose between
MULTI_PAGESET_LOCATOR_RESULTS and DEFAULT_LOCATOR_RESULTS, and treat the
presence of both document.__?.locatorSourcePageSets and
document.__?.sourceEntityPageSetTemplate as an error state (do not silently
return the multi-pageset fixture). Ensure you reference
getLocatorFixtureResults, MULTI_PAGESET_LOCATOR_RESULTS,
DEFAULT_LOCATOR_RESULTS, document._pageset.typeConfig.locatorConfig.sources, and
document.__.sourceEntityPageSetTemplate when making the change.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@packages/visual-editor/src/components/Locator.test.tsx`:
- Around line 270-273: Update getLocatorFixtureResults to determine fixture mode
from the parsed locator config rather than raw truthiness: inspect
document._pageset?.typeConfig?.locatorConfig?.sources and whether that
represents a multi-pageset (vs a single source) to choose between
MULTI_PAGESET_LOCATOR_RESULTS and DEFAULT_LOCATOR_RESULTS, and treat the
presence of both document.__?.locatorSourcePageSets and
document.__?.sourceEntityPageSetTemplate as an error state (do not silently
return the multi-pageset fixture). Ensure you reference
getLocatorFixtureResults, MULTI_PAGESET_LOCATOR_RESULTS,
DEFAULT_LOCATOR_RESULTS, document._pageset.typeConfig.locatorConfig.sources, and
document.__.sourceEntityPageSetTemplate when making the change.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: f86b9300-3ee7-46b3-9113-30f904ecf4f5

📥 Commits

Reviewing files that changed from the base of the PR and between 397bfb9 and a896626.

⛔ Files ignored due to path filters (32)
  • packages/visual-editor/src/components/testing/screenshots/Locator/[desktop] latest version default props.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[desktop] latest version multi-pageset default props.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[desktop] latest version non-default props.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[desktop] version 24 with filters (after interactions).png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[desktop] version 24 with filters.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[desktop] version 60 custom heading with site color 2.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[desktop] version 60 custom heading.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[desktop] version 60 custom title and result cards with site color 3.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[desktop] version 64 static headings (after interactions).png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[desktop] version 64 static headings.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[desktop] version 64 static image.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[mobile] latest version default props.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[mobile] latest version multi-pageset default props.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[mobile] latest version non-default props.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[mobile] version 24 with filters.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[mobile] version 60 custom heading with site color 2.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[mobile] version 60 custom heading.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[mobile] version 60 custom title and result cards with site color 3.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[mobile] version 64 static headings (after interactions).png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[mobile] version 64 static headings.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[mobile] version 64 static image.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[tablet] latest version default props.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[tablet] latest version multi-pageset default props.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[tablet] latest version non-default props.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[tablet] version 24 with filters (after interactions).png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[tablet] version 24 with filters.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[tablet] version 60 custom heading with site color 2.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[tablet] version 60 custom heading.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[tablet] version 60 custom title and result cards with site color 3.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[tablet] version 64 static headings (after interactions).png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[tablet] version 64 static headings.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[tablet] version 64 static image.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
📒 Files selected for processing (1)
  • packages/visual-editor/src/components/Locator.test.tsx

Copy link
Copy Markdown
Contributor

@jwartofsky-yext jwartofsky-yext left a comment

Choose a reason for hiding this comment

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

could be broken down more, but otherwise lgtm

@mkilpatrick mkilpatrick merged commit 99b1364 into main Apr 13, 2026
17 checks passed
@mkilpatrick mkilpatrick deleted the font-size-selector-field branch April 13, 2026 20:47
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.

5 participants