Skip to content
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

Fix Pilulka.{cz,sk} widget #2079

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Open

Conversation

Strajk
Copy link
Contributor

@Strajk Strajk commented Apr 3, 2024

Pilulka took the SPA pill

Screenshot-2024-04-03T13.42.09.mp4

@Strajk Strajk marked this pull request as ready for review April 3, 2024 11:44
lib/parse.mjs Show resolved Hide resolved
Copy link
Collaborator

@rarous rarous left a comment

Choose a reason for hiding this comment

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

Please change setTimeout to mutation observer of given element

const product = data.find(x => x["@type"] === "Product");
// Give Nuxt 100ms to replace the json-ld script tag with correct data,
// otherwise it could contain old product when using SPA navigation
await new Promise(resolve => setTimeout(resolve, 100));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please, wait for the observed change of element. Don't introduce arbitrary race conditions.

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.

None yet

2 participants