Skip to content

Enhance usePaginationModel with guard functions #3835

@fidrach

Description

@fidrach

🚀 Feature Proposal

Enable guard function to usePaginationModel similar to existing model patterns like useSelectModel

Motivation

We have an internal discard changes confirmation that appears when an action can navigate away. Pagination is one of them so we need a way to stop the internal selection of changing pages under certain conditions.

Example

  const model = usePaginationModel({
    lastPage,
    shouldPageChange: () => {
      if(discardChanges === true) return false;
      return true;
    },
    onPageChange: number => console.log(number),
  });

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    🆕 New

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions