Skip to content

Commit

Permalink
fix: Page control re-renders entire component (#1737)
Browse files Browse the repository at this point in the history
Co-authored-by: alimpens <[email protected]>
Co-authored-by: Aram <[email protected]>
  • Loading branch information
3 people authored Nov 8, 2024
1 parent 121b9de commit 473f740
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion storybook/src/components/Pagination/Pagination.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 }) => (
<div key={JSON.stringify(args)} id="ams-docs-custom-root">
<Story />
</div>
),
],
parameters: {
html: {
root: '#ams-docs-custom-root',
},
},
} satisfies Meta<typeof Pagination>

export default meta
Expand Down

0 comments on commit 473f740

Please sign in to comment.