From 473f7402ed920a8d5e2dabe2697d995adfce3487 Mon Sep 17 00:00:00 2001 From: Ruben Sibon Date: Fri, 8 Nov 2024 16:27:19 +0100 Subject: [PATCH] fix: Page control re-renders entire component (#1737) Co-authored-by: alimpens Co-authored-by: Aram <37216945+alimpens@users.noreply.github.com> --- .../Pagination/Pagination.stories.tsx | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/storybook/src/components/Pagination/Pagination.stories.tsx b/storybook/src/components/Pagination/Pagination.stories.tsx index b7f7e3e728..935b5d8981 100644 --- a/storybook/src/components/Pagination/Pagination.stories.tsx +++ b/storybook/src/components/Pagination/Pagination.stories.tsx @@ -14,7 +14,28 @@ const meta = { maxVisiblePages: 7, totalPages: 10, }, - argTypes: { onPageChange: { action: 'page changed' } }, + argTypes: { + onPageChange: { action: 'page changed' }, + page: { + control: { + type: 'number', + min: 1, + }, + }, + }, + decorators: [ + // Wrap the story in a div with a key, to force a rerender when the 'page' arg changes + (Story, { args }) => ( +
+ +
+ ), + ], + parameters: { + html: { + root: '#ams-docs-custom-root', + }, + }, } satisfies Meta export default meta