Skip to content

Conversation

@benlife5
Copy link
Contributor

https://yext.slack.com/archives/C0A1G447MPD/p1765923796393329

Screen.Recording.2025-12-17.at.1.14.05.PM.mov
  1. set nearby locations to always use yextDisplayCoordinate
  2. Previously, as soon as we rendered the empty state, the slot component that queried for nearby locations would unmount. If nearby locations came in scope due to a parameter change, nothing would update because the query was no longer active. This moves the empty state down into the slot component so that updates to the parameters still trigger a requery.

@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 Dec 17, 2025

Warning

Rate limit exceeded

@benlife5 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 16 minutes and 11 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.

📥 Commits

Reviewing files that changed from the base of the PR and between 97552ce and a84a6fd.

📒 Files selected for processing (1)
  • packages/visual-editor/src/components/pageSections/NearbyLocations/NearbyLocations.test.tsx (2 hunks)

Walkthrough

The NearbyLocations section simplifies its public props and visibility logic: the NearbyLocationsSectionProps now exposes styles, analytics, slots, and liveVisibility. The parent component removes its internal empty-state UI and surrounding outer-class gating, delegating empty-state presentation to NearbyLocationsCardsWrapper, which also drops the coordinate field from its public data props and uses a constant placeholder internally. Default layout version was bumped (mainDefaultLayout root props from 41 to 46) to reflect removal of the NearbyLocation coordinate/default yextDisplayCoordinate.

Possibly related PRs

  • fix: restore functionality from merge #882: Modifies NearbyLocations empty-state handling and rendering logic; directly overlaps with visibility/empty-state changes in this PR.
  • fix: slots qa part 3 #863: Removes NearbyLocation coordinate and yextDisplayCoordinate from props/default layout, matching the layout and prop removals here.
  • feat: use ref_listings #846: Removes coordinate fields across visual-editor components, overlapping API-level changes to nearby location coordinate usage.

Suggested labels

create-dev-release

Suggested reviewers

  • briantstephan
  • mkilpatrick
  • colton-demetriou

Pre-merge checks and finishing touches

✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix: nearby locations coordinate and empty state' directly summarizes the main changes: it addresses coordinate handling and empty state rendering logic for nearby locations.
Description check ✅ Passed The description explains the two key changes (always using yextDisplayCoordinate and moving empty state into the slot component) and provides context about the problem being solved.

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.

Actionable comments posted: 1

🧹 Nitpick comments (4)
packages/visual-editor/src/components/pageSections/NearbyLocations/NearbyLocationsCardsWrapper.tsx (2)

11-15: Coordinate sourcing via yextDisplayCoordinate and enablement checks look sound (with one small edge case)

  • Using resolveComponentData on the yextDisplayCoordinate field with constantValueEnabled: false correctly centralizes all queries on the entity’s display coordinate instead of layout-provided props.
  • enableNearbyLocations defensively checks business/env fields, coordinate presence, and basic data params before hitting the API, which should prevent bad requests.
  • Because you use !!data?.radius, a configured radius of 0 (which is allowed by min: 0 in the field config) will disable the feature. If 0 is not a valid radius, consider tightening the field to min: 1; if 0 should be valid, switch the check to explicit undefined/null tests instead of truthiness.

Example if you want to treat 0 as valid:

-    coordinate?.longitude !== undefined &&
-    !!data?.radius &&
-    !!data?.limit;
+    coordinate?.longitude !== undefined &&
+    data?.radius !== undefined &&
+    data?.limit !== undefined;

Also applies to: 18-19, 194-205, 225-235, 237-265


344-385: Nice reusable NearbyLocationsEmptyState component; copy and fallbacks make sense

  • Using useTemplateMetadata to pull entityTypeDisplayName and then lowercasing it, with fallbacks to "page" / "entity", gives editors helpful, contextual messaging without risking undefined text.
  • pt keys are well-structured and include the radius in the message; defaulting to 10 when radius is missing is reasonable given the default props.

This component is a good, focused UI piece that keeps the wrapper logic simple.

If you want to be extra defensive, you could clamp the displayed radius to a minimum of 1 here as well, to avoid ever showing “within 0 miles” in the UI.

packages/visual-editor/src/components/pageSections/NearbyLocations/NearbyLocations.tsx (2)

95-124: Empty-state driven visibility logic is reasonable and matches the new wrapper contract

  • Tracking showHeading and hideEntireSection via a single checkIfEmptyState that inspects:
    • data-empty-state, data-loading, and the card wrapper id$="-wrapper" is a pragmatic way to infer whether nearby locations are actually present or loading.
  • Using both ResizeObserver and MutationObserver on the cards wrapper div ensures the section reacts to content and layout changes, and cleanup (unobserve + disconnect) avoids leaks.
  • Hiding the whole section on live (hideEntireSection && !puck.isEditing) while still rendering the empty-state component in edit mode aligns with the new UX.

No correctness issues stand out here.

If this observer logic ever grows, consider extracting checkIfEmptyState into a small helper for easier unit testing and reuse.

Also applies to: 126-148, 156-167


121-124: Remove leftover console.log debugging statements

There are two debug logs ("hasEmptyStateMarker" and "here") that will fire on every resize/mutation or when the section hides. These should be removed or gated behind a debug flag before shipping.

Example:

-      setShowHeading(shouldShow);
-      console.log("hasEmptyStateMarker", hasEmptyStateMarker, puck.isEditing);
-      setHideEntireSection(hasEmptyStateMarker && !puck.isEditing);
+      setShowHeading(shouldShow);
+      setHideEntireSection(hasEmptyStateMarker && !puck.isEditing);
@@
-  if (hideEntireSection) {
-    console.log("here");
-    return <></>;
-  }
+  if (hideEntireSection) {
+    return <></>;
+  }

Also applies to: 151-153

📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3e1e985 and 55a9f9f.

📒 Files selected for processing (4)
  • packages/visual-editor/src/components/pageSections/NearbyLocations/NearbyLocations.tsx (4 hunks)
  • packages/visual-editor/src/components/pageSections/NearbyLocations/NearbyLocationsCardsWrapper.tsx (4 hunks)
  • packages/visual-editor/src/vite-plugin/defaultLayoutData.ts (1 hunks)
  • starter/localData/dev-location-stream__en__8573da7e3961090ddb59214a1f01e59a.json (3 hunks)
🧰 Additional context used
🪛 Gitleaks (8.30.0)
starter/localData/dev-location-stream__en__8573da7e3961090ddb59214a1f01e59a.json

[high] 8-8: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

🔇 Additional comments (5)
packages/visual-editor/src/vite-plugin/defaultLayoutData.ts (1)

4-4: Version bump for main layout looks consistent with Nearby Locations changes

The main layout version update to 46 aligns with the structural changes (notably Nearby Locations), and nothing else here appears at risk.

starter/localData/dev-location-stream__en__8573da7e3961090ddb59214a1f01e59a.json (2)

154-154: businessId change is data-only and self-contained

The businessId swap is localized to this dev fixture; no functional issues are apparent here as long as it matches the intended Yext account.

Please confirm this businessId corresponds to the entity you expect to use for nearby-locations testing in your Yext account.


879-879: uid update is consistent as an internal identifier

The updated uid is just an internal identifier in this mock entity; no behavioral concerns from this change alone.

packages/visual-editor/src/components/pageSections/NearbyLocations/NearbyLocationsCardsWrapper.tsx (1)

277-285: Empty-state contract with parent section is clean and predictable

  • Returning NearbyLocationsEmptyState while editing, and a bare <div data-empty-state="true" /> on live, gives the parent section enough information to hide the entire section on live while still showing a clear explanation in the editor.
  • Guarding on both !enableNearbyLocations and !nearbyLocationsData?.response?.docs?.length covers both misconfiguration and “no results” cases consistently.

No functional concerns here.

packages/visual-editor/src/components/pageSections/NearbyLocations/NearbyLocations.tsx (1)

174-216: Default slot props wiring to the cards wrapper looks consistent

  • Passing defaultNearbyLocationsCardsProps directly into the NearbyLocationCardsWrapper slot ensures the wrapper and section stay in sync on defaults.
  • The resolveData function correctly propagates the SectionHeadingSlot’s heading level down to sectionHeadingLevel on the cards wrapper, preserving semantic heading structure.

This configuration looks coherent with the new props and behavior.

@benlife5 benlife5 force-pushed the update-nearby-locations branch from c775a09 to d6e451f Compare December 17, 2025 18:26
@yext yext deleted a comment from coderabbitai bot Dec 17, 2025
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: 2

📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 55a9f9f and d6e451f.

⛔ Files ignored due to path filters (15)
  • packages/visual-editor/src/components/testing/screenshots/BreadcrumbsSection/[tablet] default props with document data.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/BreadcrumbsSection/[tablet] version 4 props.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/BreadcrumbsSection/[tablet] version 8 with non-default props with document data.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/ReviewsSection/[desktop] default props with document data.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/ReviewsSection/[desktop] version 10 props with French locale.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/ReviewsSection/[desktop] version 10 props with document data.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/ReviewsSection/[desktop] version 39 props with document data.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/ReviewsSection/[mobile] default props with document data.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/ReviewsSection/[mobile] version 10 props with French locale.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/ReviewsSection/[mobile] version 10 props with document data.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/ReviewsSection/[mobile] version 39 props with document data.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/ReviewsSection/[tablet] default props with document data.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/ReviewsSection/[tablet] version 10 props with French locale.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/ReviewsSection/[tablet] version 10 props with document data.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/ReviewsSection/[tablet] version 39 props with document data.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
📒 Files selected for processing (3)
  • packages/visual-editor/src/components/pageSections/NearbyLocations/NearbyLocations.tsx (4 hunks)
  • packages/visual-editor/src/components/pageSections/NearbyLocations/NearbyLocationsCardsWrapper.tsx (4 hunks)
  • packages/visual-editor/src/vite-plugin/defaultLayoutData.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/visual-editor/src/components/pageSections/NearbyLocations/NearbyLocationsCardsWrapper.tsx
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-10-29T22:00:03.843Z
Learnt from: mkouzel-yext
Repo: yext/visual-editor PR: 833
File: packages/visual-editor/src/components/Locator.tsx:1050-1057
Timestamp: 2025-10-29T22:00:03.843Z
Learning: In packages/visual-editor/src/components/Locator.tsx, the AppliedFilters component is intentionally rendered in two locations (inside the filter modal and outside it) as per the design requirements. This dual rendering should not be flagged as a duplicate issue.

Applied to files:

  • packages/visual-editor/src/components/pageSections/NearbyLocations/NearbyLocations.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: call_unit_test / unit_tests (20.x)
  • GitHub Check: call_unit_test / unit_tests (18.x)
  • GitHub Check: semgrep/ci
🔇 Additional comments (4)
packages/visual-editor/src/vite-plugin/defaultLayoutData.ts (1)

4-4: LGTM! Version bump aligns with data structure changes.

The version increment from 41 to 46 correctly reflects the removal of the coordinate field from the NearbyLocationCardsWrapper data structure.

packages/visual-editor/src/components/pageSections/NearbyLocations/NearbyLocations.tsx (3)

20-20: LGTM! Import correctly supports refactored default props.

The import of defaultNearbyLocationsCardsProps is properly used in the component's default configuration.


100-104: LGTM! Clear state management for visibility control.

The state variables showHeading and hideEntireSection provide clear separation between editor and live page behavior, with descriptive comments explaining their purpose.


157-161: LGTM! Conditional rendering correctly implements visibility logic.

The PageSection is always rendered with the background, and the heading is conditionally shown based on the showHeading state, which correctly handles the empty state behavior difference between editor and live page.

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

🧹 Nitpick comments (1)
packages/visual-editor/src/components/pageSections/NearbyLocations/NearbyLocations.tsx (1)

117-117: Consider using a more explicit content marker.

The selector '[id$="-wrapper"]' relies on child components following a specific ID naming pattern. If the NearbyLocationsCardsWrapper implementation changes its ID structure, this check will break.

Consider using an explicit data attribute (e.g., data-has-cards="true") on the cards container for more robust and self-documenting content detection.

📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d6e451f and b539b33.

📒 Files selected for processing (1)
  • packages/visual-editor/src/components/pageSections/NearbyLocations/NearbyLocations.tsx (4 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-10-29T22:00:03.843Z
Learnt from: mkouzel-yext
Repo: yext/visual-editor PR: 833
File: packages/visual-editor/src/components/Locator.tsx:1050-1057
Timestamp: 2025-10-29T22:00:03.843Z
Learning: In packages/visual-editor/src/components/Locator.tsx, the AppliedFilters component is intentionally rendered in two locations (inside the filter modal and outside it) as per the design requirements. This dual rendering should not be flagged as a duplicate issue.

Applied to files:

  • packages/visual-editor/src/components/pageSections/NearbyLocations/NearbyLocations.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: call_unit_test / unit_tests (18.x)
  • GitHub Check: call_unit_test / unit_tests (20.x)
  • GitHub Check: semgrep/ci
🔇 Additional comments (3)
packages/visual-editor/src/components/pageSections/NearbyLocations/NearbyLocations.tsx (3)

150-152: LGTM! Debug statement removed.

The early return logic correctly hides the entire section on live pages when empty. The debug console.log from the previous review has been properly removed.


157-162: LGTM! Conditional rendering aligns with empty-state refactor.

The heading now conditionally renders based on showHeading, while the CardsWrapperSlot always renders (with the ref) to enable observer checks. This correctly implements the PR objective of moving empty-state handling into the slot component.


20-20: Import verified. The defaultNearbyLocationsCardsProps constant is properly exported from ./NearbyLocationsCardsWrapper.

asanehisa
asanehisa previously approved these changes Dec 17, 2025
Copy link
Contributor

@asanehisa asanehisa left a comment

Choose a reason for hiding this comment

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

overall looks good but locator is being flaky in a test?

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

📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b539b33 and 97552ce.

⛔ Files ignored due to path filters (12)
  • packages/visual-editor/src/components/testing/screenshots/ReviewsSection/[desktop] default props with document data (after interactions).png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/ReviewsSection/[desktop] version 10 props with French locale (after interactions).png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/ReviewsSection/[desktop] version 10 props with document data (after interactions).png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/ReviewsSection/[desktop] version 39 props with document data (after interactions).png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/ReviewsSection/[mobile] default props with document data (after interactions).png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/ReviewsSection/[mobile] version 10 props with French locale (after interactions).png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/ReviewsSection/[mobile] version 10 props with document data (after interactions).png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/ReviewsSection/[mobile] version 39 props with document data (after interactions).png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/ReviewsSection/[tablet] default props with document data (after interactions).png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/ReviewsSection/[tablet] version 10 props with French locale (after interactions).png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/ReviewsSection/[tablet] version 10 props with document data (after interactions).png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/ReviewsSection/[tablet] version 39 props with document data (after interactions).png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
📒 Files selected for processing (1)
  • packages/visual-editor/src/components/pageSections/NearbyLocations/NearbyLocations.test.tsx (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: call_unit_test / unit_tests (18.x)
  • GitHub Check: call_unit_test / unit_tests (20.x)
  • GitHub Check: semgrep/ci
🔇 Additional comments (1)
packages/visual-editor/src/components/pageSections/NearbyLocations/NearbyLocations.test.tsx (1)

195-198: LGTM! Coordinate data additions align with PR objective.

The addition of yextDisplayCoordinate to these test documents ensures that nearby locations tests consistently have coordinate data available, which aligns with the PR's change to always use yextDisplayCoordinate for nearby locations queries.

Also applies to: 368-371

@benlife5
Copy link
Contributor Author

Originally had some real test failures in nearby locations. Fixed that and had a flaky Grid test (weird). Seems to be good now

@benlife5 benlife5 merged commit fdf599b into main Dec 17, 2025
15 checks passed
@benlife5 benlife5 deleted the update-nearby-locations branch December 17, 2025 19:39
k-gerner pushed a commit that referenced this pull request Dec 17, 2025
https://yext.slack.com/archives/C0A1G447MPD/p1765923796393329


https://github.com/user-attachments/assets/73a03ee7-29ed-412c-bbd3-7bf587483d6d


1. set nearby locations to always use yextDisplayCoordinate
2. Previously, as soon as we rendered the empty state, the slot
component that queried for nearby locations would unmount. If nearby
locations came in scope due to a parameter change, nothing would update
because the query was no longer active. This moves the empty state down
into the slot component so that updates to the parameters still trigger
a requery.

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
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