Skip to content

fix: default slot QoL #2212

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

Open
wants to merge 2 commits into
base: integrations/makeswift
Choose a base branch
from

Conversation

drewpledger
Copy link
Contributor

@drewpledger drewpledger commented Apr 9, 2025

There is now a default slot that is used where conditions do not apply, or a user does not have a group id

Before, if a group was simulated that did not exist in the "Targeted customer groups" control, we would render a message saying that you need to add this group before it can render properly. However, I realized after documenting our instructions for this that this would present several issues when modifying your storefront customer groups.

  • If you add a customer group, and assign customers to that group, every customer would see the error div until the MS user changes every instance of this component.
  • There was no way to render what every other group would see.

This PR aims to address those potential issues:

CleanShot.2025-04-09.at.18.19.38.mp4

@drewpledger drewpledger requested a review from a team as a code owner April 9, 2025 20:21
Copy link

vercel bot commented Apr 9, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
catalyst-canary ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 29, 2025 5:27pm
4 Skipped Deployments
Name Status Preview Comments Updated (UTC)
catalyst ⬜️ Ignored (Inspect) Apr 29, 2025 5:27pm
catalyst-au ⬜️ Ignored (Inspect) Visit Preview Apr 29, 2025 5:27pm
catalyst-soul ⬜️ Ignored (Inspect) Visit Preview Apr 29, 2025 5:27pm
catalyst-uk ⬜️ Ignored (Inspect) Visit Preview Apr 29, 2025 5:27pm

Copy link

changeset-bot bot commented Apr 9, 2025

⚠️ No Changeset found

Latest commit: 5078d05

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@drewpledger drewpledger force-pushed the dp/customer-groups-fix branch from 817c440 to 75305ba Compare April 9, 2025 20:28
@drewpledger drewpledger force-pushed the dp/customer-groups-fix branch from 75305ba to 4e3b49a Compare April 9, 2025 20:30
@drewpledger drewpledger force-pushed the dp/customer-groups-fix branch from 4e3b49a to 8c769d1 Compare April 9, 2025 20:48
@drewpledger drewpledger force-pushed the dp/customer-groups-fix branch from 8c769d1 to ac549ea Compare April 9, 2025 21:07
@drewpledger drewpledger force-pushed the dp/customer-groups-fix branch from ac549ea to c980cc5 Compare April 9, 2025 21:51
@drewpledger drewpledger force-pushed the dp/customer-groups-fix branch from c980cc5 to 9545414 Compare April 9, 2025 22:01
@drewpledger drewpledger force-pushed the dp/customer-groups-fix branch from 9545414 to 0151967 Compare April 9, 2025 22:18
@drewpledger drewpledger force-pushed the dp/customer-groups-fix branch from d232af6 to 36f67e8 Compare April 10, 2025 16:16
@drewpledger drewpledger force-pushed the dp/customer-groups-fix branch from 36f67e8 to eaf8ec2 Compare April 11, 2025 16:06
@drewpledger drewpledger changed the title fix: default slot + no-group adjustments fix: default slot QoL Apr 11, 2025
@drewpledger drewpledger force-pushed the dp/customer-groups-fix branch from 4432749 to 616c78a Compare April 11, 2025 17:08
@drewpledger drewpledger force-pushed the dp/customer-groups-fix branch from 616c78a to 2eaf036 Compare April 11, 2025 19:11
const actualSlot = allSlots?.find((s) => s.group === `${customerGroupId}`)?.slot ?? (
<UntargetedGroup />
);
const customerGroup = customerGroupId || DEFAULT_GROUP_ID;
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you set the default to `DEFAULT_GROUP_ID1 in line 46 directly so you don't have to do it here?

function CustomerGroupSlot({ className, slots, simulatedGroup = NO_GROUP_ID, noGroupSlot }: Props) {
const allSlots = slots?.concat({ group: NO_GROUP_ID, slot: noGroupSlot });
function CustomerGroupSlot({ className, slots, simulatedGroup, defaultSlot }: Props) {
const targetedSlots = slots?.concat({ group: DEFAULT_GROUP_ID, slot: defaultSlot });
const isInBuilder = useIsInBuilder();
Copy link
Contributor

Choose a reason for hiding this comment

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

Was there a decision made on if this function was something that was ok to use?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup, Miguel approved the usage

Copy link
Collaborator

@migueloller migueloller left a comment

Choose a reason for hiding this comment

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

@drewpledger, these changes look good to me. I thought we were planning on getting rid of this component due to some issues we found, though?

}))
.filter((option) => option.label.toLowerCase().includes(query.toLowerCase()));
return [
{ id: NO_GROUP_ID, label: 'No-group', value: NO_GROUP_ID },
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should the label be "No group", without the hyphen?

Copy link
Contributor

⚡️🏠 Lighthouse report

Lighthouse ran against https://catalyst-canary-c3fta4b1f-bigcommerce-platform.vercel.app

🖥️ Desktop

We ran Lighthouse against the changes on a desktop and produced this report. Here's the summary:

Category Score
🟢 Performance 99
🟢 Accessibility 92
🟠 Best practices 78
🟢 SEO 91

📱 Mobile

We ran Lighthouse against the changes on a mobile and produced this report. Here's the summary:

Category Score
🟠 Performance 57
🟢 Accessibility 92
🟠 Best practices 78
🟢 SEO 90

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