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

Feat reducer payload #10381

Open
wants to merge 2 commits into
base: 4.x
Choose a base branch
from
Open

Conversation

mytharcher
Copy link

Problem

To pass custom parameters to useGetList API, such as cursor based pagination.

Discussed in #1510 (comment).

Solution

  • Add full params update action in queryReducer.ts
  • Pass all custom params to useGetList API.

How To Test

Pass customized parameter from customized pagination component, such as lastItem. Here is example:

    const onNext = useCallback(() => {
        changeParams({
            payload: {
            filter: filterValues,
            // page,
            // perPage,
            'pagination.pageSize': pageSize,
            'pagination.lastItem': pagination?.lastItem,
            'pagination.scanForward': 1
        }
    }, [filterValues, pagination, pageSize]);

Additional Checks

  • The PR targets master for a bugfix, or next for a feature
  • The PR includes unit tests (if not possible, describe why)
  • The PR includes one or several stories (if not possible, describe why)
  • The documentation is up to date

Also, please make sure to read the contributing guidelines.

@fzaninotto
Copy link
Member

You need to update the documentation, add unit tests and stories for this new feature to be reviewed. Besides, removing whitelisting of query parameters is a red line that we don't want to cross.

@mytharcher
Copy link
Author

Thanks for you quick response!

Besides, removing whitelisting of query parameters is a red line that we don't want to cross.

I guessed so.

But developers can not achieve cursor based pagination unless passing custom parameters into getList requests.

Or is there any plan for the cursor based pagination officially?

@fzaninotto
Copy link
Member

But developers can not achieve cursor based pagination unless passing custom parameters into getList requests.

They can since v5.2.0, and the support for response metadata (cf #10179). You can add meta to the whitelist of the list route query parameters, but not a wildcard.

You'll need to build an end-to-end Story to demonstrate that your approach satisfies the requirements for cursor-based pagination.

Also, I noticed you PRed against branch 4.x. React-admin v4 is feature-freeze. All PRs for new features should be done against the next branch, which is based on 5.x.

@mytharcher
Copy link
Author

They can since v5.2.0, and the support for response metadata (cf #10179). You can add meta to the whitelist of the list route query parameters, but not a wildcard.

Thanks for this information. I PRed to 4.x because we are using it, and upgrade to 5.x may take a lot more time to migrate and verify all functions.

But I will try meta in 5.x to see if it works for us.

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