-
Notifications
You must be signed in to change notification settings - Fork 0
fix: case where address.region doesn't exist and add support for sourceEntityPageSetTemplate #1016
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
commit: |
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the 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. WalkthroughThe resolver now accepts an additional boolean parameter, Sequence Diagram(s)Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this 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 topathInfo.template.If
sourceEntityPageSetTemplateis missing, child resolution should still work whenpathInfo.templateexists (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"); + }); });
Fix case where address.region doesn't exist
https://yext.slack.com/archives/C02UVSE7P6W/p1770053437068139?thread_ts=1770047369.586719&cid=C02UVSE7P6W
Add support for
sourceEntityPageSetTemplateper slack with spruce: https://yext.slack.com/archives/C03TMB9N6KZ/p1770054261764289