Skip to content

Commit

Permalink
revert latest change
Browse files Browse the repository at this point in the history
  • Loading branch information
bl4de committed Feb 14, 2025
1 parent 3431443 commit fb8cb65
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions blocks/targeted-block/targeted-block.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,8 @@ import { getUserTokenCookie } from '../../scripts/initializers/index.js';

const blocks = [];
const displayedBlockTypes = [];
let updated = false;

const updateTargetedBlocksVisibility = async () => {
if (updated) {
return;
}

const activeRules = {
customerSegments: [],
customerGroup: await getCustomerGroups(),
Expand Down Expand Up @@ -66,7 +61,6 @@ const updateTargetedBlocksVisibility = async () => {
block.style.display = '';
}
});
updated = true;
};

export default function decorate(block) {
Expand All @@ -75,14 +69,14 @@ export default function decorate(block) {
block.setAttribute('data-targeted-block-key', blocks.length - 1);
}

events.on('authenticated', () => {
events.on('cart/initialized', () => {
updateTargetedBlocksVisibility();
}, { eager: true });

events.on('cart/initialized', () => {
events.on('cart/updated', () => {
updateTargetedBlocksVisibility();
}, { eager: true });

events.on('cart/updated', () => {
events.on('authenticated', () => {
updateTargetedBlocksVisibility();
}, { eager: true });

0 comments on commit fb8cb65

Please sign in to comment.