Skip to content

fix: comingSoon in locator results#1225

Merged
asanehisa merged 4 commits into
mainfrom
fix-locator
Jun 2, 2026
Merged

fix: comingSoon in locator results#1225
asanehisa merged 4 commits into
mainfrom
fix-locator

Conversation

@asanehisa
Copy link
Copy Markdown
Contributor

Before:
Screenshot 2026-06-02 at 11 56 38 AM

Now the accordion is hidden when comingSoon is true.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 2, 2026

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
Copy Markdown
Contributor

coderabbitai Bot commented Jun 2, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: d505981d-cf49-4897-9fff-c3fb828a01a5

📥 Commits

Reviewing files that changed from the base of the PR and between 8c8787b and 2cf130e.

⛔ Files ignored due to path filters (3)
  • packages/visual-editor/src/components/testing/screenshots/Locator/[desktop] version 74 comingSoon.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[mobile] version 74 comingSoon.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
  • packages/visual-editor/src/components/testing/screenshots/Locator/[tablet] version 74 comingSoon.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
📒 Files selected for processing (1)
  • packages/visual-editor/src/components/LocatorResultCard.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/visual-editor/src/components/LocatorResultCard.tsx

Walkthrough

This PR adds support for a comingSoon display mode to the Locator hours section. When comingSoon is enabled, hours render in a compact row layout without the collapsible accordion; otherwise, the existing accordion-based display is preserved. Test fixtures are updated to support the comingSoon flag, and a new test case exercises the version 74 comingSoon rendering path.

sequenceDiagram
  participant LocatorResultCard
  participant HoursSection
  participant HoursStatusAtom
  LocatorResultCard->>HoursSection: pass locator data (includes comingSoon)
  HoursSection->>HoursStatusAtom: render status (comingSoon, timezone)
  alt comingSoon === true
    HoursSection->>HoursStatusAtom: render compact row (no Accordion)
  else comingSoon === false
    HoursSection->>HoursStatusAtom: render inside Accordion trigger
    HoursSection->>HoursSection: show HoursTableAtom in Accordion content on expand
  end
Loading

Possibly related PRs

  • yext/visual-editor#1155: Both PRs modify HoursSection within LocatorResultCard.tsx, changing hours accordion/trigger-content rendering and internal state management.

Suggested labels

create-dev-release

Suggested reviewers

  • jwartofsky-yext
  • mkouzel-yext
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title directly references the main change: hiding the accordion when comingSoon is true in locator results, which matches the core functionality being implemented.
Description check ✅ Passed The description is related to the changeset, explaining the visual behavior change (accordion hidden when comingSoon is true) with a before screenshot.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ 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 fix-locator

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.

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

292-304: ⚡ Quick win

Keep comingSoon on the fixture results, not the document.

LocatorResultCard branches on result.rawData.comingSoon, but this mock derives that field from document.comingSoon and applies it to every result. That makes mixed-result coverage impossible and weakens the test contract. Prefer setting comingSoon directly in the relevant createLocatorApiResult(...) fixtures and returning results unchanged here.

♻️ Suggested change
-        JSON.stringify(
-          createLocatorVerticalSearchResponse(
-            document.comingSoon
-              ? results.map((result: any) => ({
-                  ...result,
-                  data: {
-                    ...result.data,
-                    comingSoon: true,
-                  },
-                }))
-              : results
-          )
-        ),
+        JSON.stringify(createLocatorVerticalSearchResponse(results)),
// Build the intended state into the fixtures instead, e.g.
createLocatorApiResult({
  ...,
  comingSoon: true,
});
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/visual-editor/src/components/Locator.test.tsx` around lines 292 -
304, The test is mutating the fixture by applying document.comingSoon to every
result in the createLocatorVerticalSearchResponse call, which prevents testing
mixed comingSoon states used by LocatorResultCard (it checks
result.rawData.comingSoon); instead, remove the conditional mapping that sets
comingSoon from document and ensure each test fixture created via
createLocatorApiResult explicitly includes the intended comingSoon value
(true/false) so results can be returned unchanged to
createLocatorVerticalSearchResponse; update tests that relied on
document.comingSoon to set comingSoon to instead construct appropriate
createLocatorApiResult(...) entries with comingSoon set.

364-394: ⚡ Quick win

Add a direct assertion for the non-accordion behavior.

This case only validates the comingSoon path via screenshot/axe. Please also assert that the “Coming Soon” status renders and the hours accordion trigger/content are absent so this contract stays covered even when screenshot diffs are noisy.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/visual-editor/src/components/Locator.test.tsx` around lines 364 -
394, In the "version 74 comingSoon" test case in Locator.test.tsx add explicit
assertions to verify the non-accordion behavior: assert that the "Coming Soon"
status text is present (using the rendered output for LocatorComponent /
LocatorComponent.defaultProps) and assert that the hours accordion trigger and
its content are absent (use queryByText/queryByRole or the HoursAccordion
test-id/selector to confirm neither the accordion button nor the hours content
exists). This ensures the test checks both presence of the coming-soon message
and absence of the hours accordion UI.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@packages/visual-editor/src/components/Locator.test.tsx`:
- Around line 292-304: The test is mutating the fixture by applying
document.comingSoon to every result in the createLocatorVerticalSearchResponse
call, which prevents testing mixed comingSoon states used by LocatorResultCard
(it checks result.rawData.comingSoon); instead, remove the conditional mapping
that sets comingSoon from document and ensure each test fixture created via
createLocatorApiResult explicitly includes the intended comingSoon value
(true/false) so results can be returned unchanged to
createLocatorVerticalSearchResponse; update tests that relied on
document.comingSoon to set comingSoon to instead construct appropriate
createLocatorApiResult(...) entries with comingSoon set.
- Around line 364-394: In the "version 74 comingSoon" test case in
Locator.test.tsx add explicit assertions to verify the non-accordion behavior:
assert that the "Coming Soon" status text is present (using the rendered output
for LocatorComponent / LocatorComponent.defaultProps) and assert that the hours
accordion trigger and its content are absent (use queryByText/queryByRole or the
HoursAccordion test-id/selector to confirm neither the accordion button nor the
hours content exists). This ensures the test checks both presence of the
coming-soon message and absence of the hours accordion UI.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 4075d002-ee78-45dc-8556-d74a12250e52

📥 Commits

Reviewing files that changed from the base of the PR and between d48f1db and 8c8787b.

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

@asanehisa asanehisa marked this pull request as ready for review June 2, 2026 16:15
mkilpatrick
mkilpatrick previously approved these changes Jun 2, 2026
briantstephan
briantstephan previously approved these changes Jun 2, 2026
Comment thread packages/visual-editor/src/components/LocatorResultCard.tsx Outdated
@asanehisa asanehisa dismissed stale reviews from briantstephan and mkilpatrick via 2cf130e June 2, 2026 17:50
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.

lgtm!

@asanehisa asanehisa merged commit 3768f5d into main Jun 2, 2026
17 checks passed
@asanehisa asanehisa deleted the fix-locator branch June 2, 2026 18:05
asanehisa added a commit that referenced this pull request Jun 2, 2026
Same fix as #1225

---------

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.

4 participants