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

Allow passing pageOffSet as props to IS productListingPage #61

Merged
merged 2 commits into from
Sep 19, 2023

Conversation

RafaelCassiano30011
Copy link
Contributor

@RafaelCassiano30011 RafaelCassiano30011 commented Sep 18, 2023

I made a modification to check if there is a current page being passed as a prop. Previously, we were only retrieving the "page" parameter from the URL, which worked only when the page was refreshed. The code was like this:

const page =
  Math.min(
    url.searchParams.get("page") ? Number(url.searchParams.get("page")) - currentPageoffset : 0,
    VTEX_MAX_PAGES - currentPageoffset
  );

Now, we have made the following change:

const page =
  props.pageOffset ??
  Math.min(
    url.searchParams.get("page") ? Number(url.searchParams.get("page")) - currentPageoffset : 0,
    VTEX_MAX_PAGES - currentPageoffset
  );

Now, the code checks if the "pageOffset" property is present in the props. If it's present, it will use that value; otherwise, it will continue with the previous logic to obtain the page from the URL.

Copy link
Contributor

@mcandeia mcandeia left a comment

Choose a reason for hiding this comment

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

fix then ship it!

@@ -1,38 +1,16 @@
/** @format */
Copy link
Contributor

Choose a reason for hiding this comment

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

remove

@mcandeia mcandeia changed the title add verify current page Allow passing pageOffSet as props for productListingPage Sep 19, 2023
@mcandeia mcandeia changed the title Allow passing pageOffSet as props for productListingPage Allow passing pageOffSet as props to IS productListingPage Sep 19, 2023
@mcandeia mcandeia merged commit ee6ab02 into deco-cx:main Sep 19, 2023
1 check passed
vitoUwu pushed a commit to vitoUwu/deco-cx-apps that referenced this pull request Feb 12, 2024
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.

2 participants