Skip to content

Conversation

@asanehisa
Copy link
Contributor

@asanehisa asanehisa commented Feb 2, 2026

Fix case where address.region doesn't exist
https://yext.slack.com/archives/C02UVSE7P6W/p1770053437068139?thread_ts=1770047369.586719&cid=C02UVSE7P6W

Add support for sourceEntityPageSetTemplate per slack with spruce: https://yext.slack.com/archives/C03TMB9N6KZ/p1770054261764289

@asanehisa asanehisa added the create-dev-release Triggers dev release workflow label Feb 2, 2026
@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 2, 2026

commit: 1144689

@asanehisa asanehisa changed the title fix: test fix: case where address.region doesn't exist Feb 2, 2026
@asanehisa asanehisa marked this pull request as ready for review February 2, 2026 17:44
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 2, 2026

Warning

Rate limit exceeded

@asanehisa has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 21 minutes and 51 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

Walkthrough

The resolver now accepts an additional boolean parameter, isChild, and when true resolveUrlFromPathInfo prefers pathInfo.sourceEntityPageSetTemplate over pathInfo.template to derive the URL template. The function signature was extended accordingly. The URL normalization flow was expanded to explicitly collapse multiple consecutive slashes and remove any leading slash before assembling the final URL; locale-prefix behavior is unchanged. A new optional sourceEntityPageSetTemplate field was added to PathInfoShape.

Sequence Diagram(s)

Possibly related PRs

Suggested reviewers

  • briantstephan
  • benlife5
🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main changes: fixing the case where address.region doesn't exist and adding support for sourceEntityPageSetTemplate, which aligns with the changes made to resolveUrlFromPathInfo and PathInfoShape.
Description check ✅ Passed The description relates to the changeset by referencing the Slack threads documenting the issue with locale-based child linking and the pathInfo/template fallback problem being addressed.

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

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix

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.

mkilpatrick
mkilpatrick previously approved these changes Feb 2, 2026
@asanehisa asanehisa changed the title fix: case where address.region doesn't exist fix: case where address.region doesn't exist and add support for sourceEntityPageSetTemplate Feb 2, 2026
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: 1

🤖 Fix all issues with AI agents
In `@packages/visual-editor/src/utils/urls/resolveUrlFromPathInfo.ts`:
- Around line 14-19: The child-context branch currently sets urlTemplate =
pathInfoJson?.sourceEntityPageSetTemplate || "" which causes child profiles to
miss pathInfoJson.template; update the logic in the resolveUrlFromPathInfo
function (the isChild branch handling for urlTemplate) to fall back to
pathInfoJson?.template when sourceEntityPageSetTemplate is absent (e.g., use
sourceEntityPageSetTemplate || pathInfoJson?.template || ""), ensuring
urlTemplate is populated for child contexts and avoiding the legacy resolver
path.
🧹 Nitpick comments (1)
packages/visual-editor/src/utils/urls/resolveUrlTemplate.test.ts (1)

55-58: Consider a regression test for child fallback to pathInfo.template.

If sourceEntityPageSetTemplate is missing, child resolution should still work when pathInfo.template exists (especially for legacy data). Adding a test here would lock in that behavior.

🧪 Suggested test addition
 describe("resolveUrlTemplateOfChild", () => {
   it("resolves child profile URL using its own pathInfo template", () => {
     expect(
       resolveUrlTemplateOfChild(mockChildProfile, mockDMCityDocument, "")
     ).toBe("va/fairfax/2000-university-dr");
   });
+
+  it("falls back to pathInfo.template when sourceEntityPageSetTemplate is missing", () => {
+    const legacyChildProfile = {
+      ...mockChildProfile,
+      __: {
+        pathInfo: {
+          template: "[[address.region]]/[[address.city]]/[[address.line1]]",
+          primaryLocale: "en",
+        },
+      },
+    };
+
+    expect(
+      resolveUrlTemplateOfChild(legacyChildProfile, mockDMCityDocument, "")
+    ).toBe("va/fairfax/2000-university-dr");
+  });
 });

@asanehisa asanehisa merged commit d2d5b8a into main Feb 2, 2026
17 checks passed
@asanehisa asanehisa deleted the fix branch February 2, 2026 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

create-dev-release Triggers dev release workflow

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants