Skip to content

fix: more 1.1.0-alpha quick fixes#1060

Merged
benlife5 merged 5 commits intomainfrom
more-quick-fixes
Feb 25, 2026
Merged

fix: more 1.1.0-alpha quick fixes#1060
benlife5 merged 5 commits intomainfrom
more-quick-fixes

Conversation

@benlife5
Copy link
Contributor

@benlife5 benlife5 commented Feb 24, 2026

  1. The locator was using the internal/in-editor button. I think this became a problem when we switched to direct imports. The stylign for this button does not get applied on the live page so the "enable cookies" button was unstyled.
  2. I used the wrong object the check the DM list children type
  3. Links from the locator to entity pages were not working. This is because pathInfo does not come on locator pages. Instead, the legacy entityPageSetUrlTemplates includes the primary locale information, so we need to include the locale as part of the legacyResolveUrlTemplate function
Screenshot 2026-02-24 at 5 08 17 PM Screenshot 2026-02-24 at 5 08 11 PM

@github-actions
Copy link
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.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 24, 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

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1629b84 and a7a5871.

📒 Files selected for processing (1)
  • packages/visual-editor/src/components/Locator.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/visual-editor/src/components/Locator.tsx

Walkthrough

This PR makes three changes: (1) updates packages/visual-editor/src/components/Locator.tsx to import Button from the local atoms module and removes the variant="default" prop; (2) changes packages/visual-editor/src/components/directory/DirectoryWrapper.tsx to derive label mapping from each child’s own meta.entityType.id instead of from the parent streamDocument’s directory metadata; (3) refactors packages/visual-editor/src/utils/urls/legacyResolveUrlTemplate.ts to add locale-aware URL prefixing (new urlTemplate fields includeLocalePrefixForPrimaryLocale and primaryLocale), removes buildUrlFromTemplate, updates legacyResolveUrlTemplateWithTemplates signature, and adds tests covering locator-page and primary-locale behaviors.

Sequence Diagram(s)

sequenceDiagram
  participant Caller as Caller
  participant Resolver as legacyResolveUrlTemplateWithTemplates
  participant Templates as UrlTemplates
  participant Doc as StreamDocument

  Caller->>Resolver: resolve(streamDocument, relativePrefixToRoot, Templates)
  Resolver->>Templates: read primary/alternate template, includeLocalePrefixForPrimaryLocale, primaryLocale
  Resolver->>Doc: extract locale and fields (slugs, ids)
  Resolver->>Resolver: build basePath from chosen template and doc (inlined)
  alt prefix needed (primaryLocale undefined OR locale != primaryLocale OR includeLocalePrefixForPrimaryLocale)
    Resolver->>Resolver: normalize locale slug
    Resolver-->>Caller: return relativePrefixToRoot + localeSlug + "/" + basePath
  else no prefix
    Resolver-->>Caller: return relativePrefixToRoot + basePath
  end
Loading

Possibly related PRs

Suggested labels

create-dev-release

Suggested reviewers

  • asanehisa
  • briantstephan
  • jwartofsky-yext
  • mkilpatrick
🚥 Pre-merge checks | ✅ 1 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title references '1.1.0-alpha quick fixes' which aligns with the changeset fixing multiple issues (button styling, directory metadata, URL resolution), but is vague about the specific changes. Consider a more specific title that highlights the main fix, such as 'fix: locator URL resolution and button styling issues' or similar.
✅ Passed checks (1 passed)
Check name Status Explanation
Description check ✅ Passed The description clearly explains three distinct issues being fixed: button styling, directory metadata reference, and locale-aware URL resolution for locator pages.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch more-quick-fixes

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
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/directory/DirectoryWrapper.tsx (1)

31-31: Consider replacing any[] with a typed interface for directoryChildren.

any[] suppresses type-checking for all child field accesses (child.meta, child.c_addressCountryDisplayName, etc.), making future refactors of this switch block error-prone.

♻️ Suggested typing
+type DirectoryChild = {
+  name: string;
+  meta?: { entityType?: { id?: string } };
+  c_addressCountryDisplayName?: string;
+  c_addressRegionDisplayName?: string;
+  [key: string]: unknown;
+};
+
 export const DirectoryList = ({
   streamDocument,
   directoryChildren,
   relativePrefixToRoot,
 }: {
   streamDocument: StreamDocument;
-  directoryChildren: any[];
+  directoryChildren: DirectoryChild[];
   relativePrefixToRoot: string;
 }) => {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/visual-editor/src/components/directory/DirectoryWrapper.tsx` at line
31, The prop typed as directoryChildren: any[] in DirectoryWrapper should be
replaced with a concrete interface to restore type-safety; define an interface
(e.g., DirectoryChild) listing the fields accessed in the component/switch (for
example meta, c_addressCountryDisplayName, id, label, children, etc.), update
the prop type to DirectoryChild[] and adjust any local variables or function
signatures that consume directoryChildren so the compiler can catch invalid
accesses inside the switch that references child.meta and other properties.
🤖 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/directory/DirectoryWrapper.tsx`:
- Line 31: The prop typed as directoryChildren: any[] in DirectoryWrapper should
be replaced with a concrete interface to restore type-safety; define an
interface (e.g., DirectoryChild) listing the fields accessed in the
component/switch (for example meta, c_addressCountryDisplayName, id, label,
children, etc.), update the prop type to DirectoryChild[] and adjust any local
variables or function signatures that consume directoryChildren so the compiler
can catch invalid accesses inside the switch that references child.meta and
other properties.

ℹ️ Review info

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ad8f756 and a3e23ac.

📒 Files selected for processing (2)
  • packages/visual-editor/src/components/Locator.tsx
  • packages/visual-editor/src/components/directory/DirectoryWrapper.tsx

mkilpatrick
mkilpatrick previously approved these changes Feb 24, 2026
asanehisa
asanehisa previously approved these changes Feb 25, 2026
@benlife5 benlife5 dismissed stale reviews from asanehisa and mkilpatrick via 6a642cc February 25, 2026 15:02
@benlife5
Copy link
Contributor Author

Updated:

Links from the locator to entity pages were not working. This is because pathInfo does not come on locator pages. Instead, the legacy entityPageSetUrlTemplates includes the primary locale information, so we need to include the locale as part of the legacyResolveUrlTemplate function

Copy link
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: 5

♻️ Duplicate comments (1)
packages/visual-editor/src/utils/urls/legacyResolveUrlTemplate.test.ts (1)

88-91: Same fixture flag mismatch as other URL tests.

This mock also uses includePrimaryLocalePrefixForPrimaryLocale, while resolver logic reads includeLocalePrefixForPrimaryLocale, so coverage for that branch is inconsistent.

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

In `@packages/visual-editor/src/utils/urls/legacyResolveUrlTemplate.test.ts`
around lines 88 - 91, The test fixture uses the wrong flag name: change the JSON
key from "includePrimaryLocalePrefixForPrimaryLocale" to
"includeLocalePrefixForPrimaryLocale" so the mock aligns with the resolver logic
(the code path checked by legacyResolveUrlTemplate / resolver that reads
includeLocalePrefixForPrimaryLocale will then be covered); update the
entityPageSetUrlTemplates JSON string accordingly in the test fixture.
🤖 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/utils/urls/legacyResolveUrlTemplate.test.ts`:
- Around line 146-154: The test title is misleading: update the second it(...)
title that currently reads "handles primary locale on new locator pages" to
reflect that the input sets locale: "es" (a non-primary locale); locate the test
calling legacyResolveUrlTemplate with { ...mockNewLocatorMergedDocument, locale:
"es" } and change its description to something like "handles non-primary locale
on new locator pages" so the test name matches the scenario.

In `@packages/visual-editor/src/utils/urls/legacyResolveUrlTemplate.ts`:
- Around line 72-83: The resolvedUrl returned from buildUrlFromTemplate can be
undefined and is being interpolated into strings, causing "undefined" to appear
in paths; update legacyResolveUrlTemplate to guard resolvedUrl (the variable
produced by buildUrlFromTemplate) before interpolation—either coerce it to a
safe fallback (e.g., empty string) or return/throw early when undefined, then
construct the returned path using normalized locale and relativePrefixToRoot
only when resolvedUrl is present; ensure the logic still respects
urlTemplates.primaryLocale and urlTemplates.includeLocalePrefixForPrimaryLocale
and continues to call normalizeSlug(locale) only in the branch that includes the
locale prefix.
- Around line 75-79: The condition currently uses the "in" operator on
urlTemplates to check primaryLocale and may treat { primaryLocale: undefined }
as present; change the if in legacyResolveUrlTemplate to verify a defined,
non-empty value (e.g., urlTemplates.primaryLocale != null &&
urlTemplates.primaryLocale !== '' or Boolean(urlTemplates.primaryLocale)) before
comparing to locale or checking includeLocalePrefixForPrimaryLocale, so replace
the `"primaryLocale" in urlTemplates` check with this defined-value check for
urlTemplates.primaryLocale while keeping the existing comparisons to locale and
urlTemplates.includeLocalePrefixForPrimaryLocale.

In `@packages/visual-editor/src/utils/urls/resolveUrlTemplate.test.ts`:
- Around line 218-226: The test title duplicates the primary-locale description
while exercising a non-primary locale; update the spec title for the test that
calls resolveUrlTemplateOfChild with { ...mockChildProfile, locale: "es" } so it
clearly describes the non-primary-locale case (e.g., "resolves locator profile
links for non-primary locale") to make failures interpretable; change only the
it(...) string for that test while leaving the test body and the call to
resolveUrlTemplateOfChild, mockLocatorDocument, and expected assertion intact.
- Around line 53-56: The test fixture uses the flag
includePrimaryLocalePrefixForPrimaryLocale but the resolver
(legacyResolveUrlTemplate.ts) expects includeLocalePrefixForPrimaryLocale;
update the fixture's entityPageSetUrlTemplates JSON to use
includeLocalePrefixForPrimaryLocale so the test exercises the resolver path (or
alternatively update legacyResolveUrlTemplate.ts to accept the
includePrimaryLocalePrefixForPrimaryLocale key if you prefer backward
compatibility); ensure the change is applied where entityPageSetUrlTemplates is
defined in the test so the resolver reads the intended flag.

---

Duplicate comments:
In `@packages/visual-editor/src/utils/urls/legacyResolveUrlTemplate.test.ts`:
- Around line 88-91: The test fixture uses the wrong flag name: change the JSON
key from "includePrimaryLocalePrefixForPrimaryLocale" to
"includeLocalePrefixForPrimaryLocale" so the mock aligns with the resolver logic
(the code path checked by legacyResolveUrlTemplate / resolver that reads
includeLocalePrefixForPrimaryLocale will then be covered); update the
entityPageSetUrlTemplates JSON string accordingly in the test fixture.

ℹ️ Review info

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a3e23ac and 6a642cc.

📒 Files selected for processing (3)
  • packages/visual-editor/src/utils/urls/legacyResolveUrlTemplate.test.ts
  • packages/visual-editor/src/utils/urls/legacyResolveUrlTemplate.ts
  • packages/visual-editor/src/utils/urls/resolveUrlTemplate.test.ts

Copy link
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.

♻️ Duplicate comments (2)
packages/visual-editor/src/utils/urls/resolveUrlTemplate.test.ts (2)

47-62: Fixture field name now matches the resolver — past mismatch is resolved.

includeLocalePrefixForPrimaryLocale aligns with the field read in legacyResolveUrlTemplate.ts Line 54.

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

In `@packages/visual-editor/src/utils/urls/resolveUrlTemplate.test.ts` around
lines 47 - 62, The fixture field in mockLocatorDocument must match what
legacyResolveUrlTemplate reads: update mockLocatorDocument (type StreamDocument)
so its __.entityPageSetUrlTemplates JSON uses the key
includeLocalePrefixForPrimaryLocale (not the old name) and ensure primaryLocale
and primary remain present; this aligns the test fixture with
legacyResolveUrlTemplate's expectations and fixes the mismatch.

212-245: Solid coverage of all three locator locale-prefix scenarios.

Primary locale without prefix (Line 212), non-primary locale with prefix (Line 218), and primary locale with includeLocalePrefixForPrimaryLocale: true forcing the prefix (Line 228). Test titles are now distinct and descriptive.

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

In `@packages/visual-editor/src/utils/urls/resolveUrlTemplate.test.ts` around
lines 212 - 245, The tests for resolveUrlTemplateOfChild already cover the three
locator locale-prefix scenarios (primary without prefix, non-primary with
prefix, and primary with includeLocalePrefixForPrimaryLocale true), so no code
changes are needed; please remove the duplicate/erroneous review marker
([duplicate_comment]) from the PR comment or update the review to a plain
approval to avoid confusion and keep the descriptive test titles as-is.
🧹 Nitpick comments (1)
packages/visual-editor/src/utils/urls/legacyResolveUrlTemplate.ts (1)

51-56: Consider extracting an explicit type for urlTemplates.

The inline type { primary?: string; alternate?: string; includeLocalePrefixForPrimaryLocale?: boolean; primaryLocale?: string; } is used in legacyResolveUrlTemplateWithTemplates and a narrower version in selectUrlTemplate. As this shape grows, a named type (e.g., UrlTemplateConfig) shared between both functions would improve readability and keep the two call sites in sync.

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

In `@packages/visual-editor/src/utils/urls/legacyResolveUrlTemplate.ts` around
lines 51 - 56, Extract a shared named type for the urlTemplates object (e.g.,
UrlTemplateConfig) and use it in both legacyResolveUrlTemplateWithTemplates and
selectUrlTemplate instead of the inline type; define UrlTemplateConfig with
fields primary?: string, alternate?: string,
includeLocalePrefixForPrimaryLocale?: boolean, primaryLocale?: string and
replace the inline annotations in both function signatures/params so the shape
is centralized and remains consistent as it evolves.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@packages/visual-editor/src/utils/urls/resolveUrlTemplate.test.ts`:
- Around line 47-62: The fixture field in mockLocatorDocument must match what
legacyResolveUrlTemplate reads: update mockLocatorDocument (type StreamDocument)
so its __.entityPageSetUrlTemplates JSON uses the key
includeLocalePrefixForPrimaryLocale (not the old name) and ensure primaryLocale
and primary remain present; this aligns the test fixture with
legacyResolveUrlTemplate's expectations and fixes the mismatch.
- Around line 212-245: The tests for resolveUrlTemplateOfChild already cover the
three locator locale-prefix scenarios (primary without prefix, non-primary with
prefix, and primary with includeLocalePrefixForPrimaryLocale true), so no code
changes are needed; please remove the duplicate/erroneous review marker
([duplicate_comment]) from the PR comment or update the review to a plain
approval to avoid confusion and keep the descriptive test titles as-is.

---

Nitpick comments:
In `@packages/visual-editor/src/utils/urls/legacyResolveUrlTemplate.ts`:
- Around line 51-56: Extract a shared named type for the urlTemplates object
(e.g., UrlTemplateConfig) and use it in both
legacyResolveUrlTemplateWithTemplates and selectUrlTemplate instead of the
inline type; define UrlTemplateConfig with fields primary?: string, alternate?:
string, includeLocalePrefixForPrimaryLocale?: boolean, primaryLocale?: string
and replace the inline annotations in both function signatures/params so the
shape is centralized and remains consistent as it evolves.

ℹ️ Review info

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6a642cc and a092074.

📒 Files selected for processing (3)
  • packages/visual-editor/src/utils/urls/legacyResolveUrlTemplate.test.ts
  • packages/visual-editor/src/utils/urls/legacyResolveUrlTemplate.ts
  • packages/visual-editor/src/utils/urls/resolveUrlTemplate.test.ts

Copy link
Collaborator

@mkilpatrick mkilpatrick left a comment

Choose a reason for hiding this comment

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

Can you add the latest update to the PR description

Copy link
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/utils/urls/legacyResolveUrlTemplate.ts (1)

82-88: Compare normalized locale values before deciding to prefix.

The condition compares raw locale strings but emits a normalized locale in the path. Normalizing both sides for the comparison avoids false non-primary matches due to casing/format differences.

💡 Proposed hardening
-  if (
-    urlTemplates.primaryLocale &&
-    (urlTemplates.primaryLocale !== locale ||
-      urlTemplates.includeLocalePrefixForPrimaryLocale)
-  ) {
-    return `${relativePrefixToRoot}${normalizeSlug(locale)}/${resolvedUrl}`;
-  }
+  const normalizedLocale = normalizeSlug(locale);
+  const normalizedPrimaryLocale = urlTemplates.primaryLocale
+    ? normalizeSlug(urlTemplates.primaryLocale)
+    : undefined;
+
+  if (
+    normalizedPrimaryLocale &&
+    (normalizedPrimaryLocale !== normalizedLocale ||
+      urlTemplates.includeLocalePrefixForPrimaryLocale)
+  ) {
+    return `${relativePrefixToRoot}${normalizedLocale}/${resolvedUrl}`;
+  }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/visual-editor/src/utils/urls/legacyResolveUrlTemplate.ts` around
lines 82 - 88, The locale-comparison uses raw values but the emitted path uses
normalizeSlug(locale), causing mismatches; update the conditional in
legacyResolveUrlTemplate (the block checking urlTemplates.primaryLocale and
urlTemplates.includeLocalePrefixForPrimaryLocale) to compare normalized values
by calling normalizeSlug on both urlTemplates.primaryLocale and locale (e.g.,
const normalizedPrimary = normalizeSlug(urlTemplates.primaryLocale); const
normalizedLocale = normalizeSlug(locale)) and then use (normalizedPrimary !==
normalizedLocale || urlTemplates.includeLocalePrefixForPrimaryLocale) so
prefixing decisions match the actual path produced.
🤖 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/utils/urls/legacyResolveUrlTemplate.ts`:
- Around line 82-88: The locale-comparison uses raw values but the emitted path
uses normalizeSlug(locale), causing mismatches; update the conditional in
legacyResolveUrlTemplate (the block checking urlTemplates.primaryLocale and
urlTemplates.includeLocalePrefixForPrimaryLocale) to compare normalized values
by calling normalizeSlug on both urlTemplates.primaryLocale and locale (e.g.,
const normalizedPrimary = normalizeSlug(urlTemplates.primaryLocale); const
normalizedLocale = normalizeSlug(locale)) and then use (normalizedPrimary !==
normalizedLocale || urlTemplates.includeLocalePrefixForPrimaryLocale) so
prefixing decisions match the actual path produced.

ℹ️ Review info

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a092074 and 1629b84.

📒 Files selected for processing (1)
  • packages/visual-editor/src/utils/urls/legacyResolveUrlTemplate.ts

@benlife5 benlife5 requested a review from mkilpatrick February 25, 2026 18:32
@benlife5 benlife5 merged commit caea166 into main Feb 25, 2026
52 of 73 checks passed
@benlife5 benlife5 deleted the more-quick-fixes branch February 25, 2026 19:25
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.

3 participants