-
Notifications
You must be signed in to change notification settings - Fork 173
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
Performance degradation of the DatePicker #1170
Comments
Can you describe this a bit more: |
Hi @joshuaellis, yes exactly. I have a custom plugin with custom page. I have created a dummy component which can be used to reproduce the issue:
|
IMHO you should be virtualising the list of the table when you want to do a table that large and there's no pagination. Anything over 50 is when you'll start running into rendering problems for large datasets (typically). We made UX improvements with the DatePicker which naturally increased the amount of code & improved accessibility so it is heavier but with regular usage we haven't seen performance issues, I would categorise this as an extreme case. |
Thank you for your answer. However, even if I reduce the dataset to 20 for example, it still takes quite a lot of time and the page will freeze for a split second. This happens specifically only with the DatePicker. Is this a normal behaviour for the DatePicker? It did not happen before in 4.10.7. One more question regarding the pagination - is it possible to use the Strapi default pagination functionality (which is for example used in content management) in custom plugins and pages? I would rather use the Strapi's build-in pagination instead of creating my own. EDIT: The performance issue was tested on Firefox and Chrome. |
hm, we'll move this to the DS so it can be investigated in due course.
FE perspective, yes probably, it's exported from the helper-plugin. BE i'm not sure about. |
This issue can be exacerbated by setting DateTimePicker step size to 1. This can be done in one of the Storiebook stories for reproduction. I am not entirely sure if this is the same issue as the OP mentions the DatePicker. This issue originates from the ComboBox component in @strapi/ui-primitives. It can be reproduced with the following Storybook story (simulating step size 1 in DateTimePicker with 60 * 24 values): export const PerformanceUsage = {
render: () => {
const values: number[] = Array.from({ length: 60 * 24 }, (value, index) => index);
return (
<Combobox.Root>
<Combobox.Trigger>
<Combobox.TextInput placeholder="Pick me" />
<Combobox.Icon />
</Combobox.Trigger>
<Combobox.Portal>
<Combobox.Content>
<Combobox.Viewport>
{values.map((value) =>
<Combobox.Item value={value} key={value}>
<Combobox.ItemText>Option {value}</Combobox.ItemText>
<Combobox.ItemIndicator>
<Check />
</Combobox.ItemIndicator>
</Combobox.Item>
)}
<Combobox.NoValueFound>No value</Combobox.NoValueFound>
</Combobox.Viewport>
</Combobox.Content>
</Combobox.Portal>
</Combobox.Root>
)
},
name: 'Performance',
} satisfies Story; |
Bug report
Required System information
Describe the bug
The DatePicker is degrading drastically the performance of the page which uses them. I am rendering around 100 date pickers per page. This issue started from 4.11.0 - when using version 4.10.7 the DatePickers are rendered without high performance degradation. I tried to use only the basic DatePicker without additional logic and the performance was degraded the same.
Please let me know if more information is needed.
The basic DatePicker:
<DatePicker onChange={() => {}} selectedDate={new Date('1990-01-01')} label="Your birthday" onClear={() => {}} />;
Steps to reproduce the behavior
Screenshots
This is performance insight for the page with DatePickers (around 100 rendered), takes 16 seconds:
After I remove the DatePicker, the webpage is rendered in less then 4 seconds. Only the DatePicker is removed, nothing else:
The text was updated successfully, but these errors were encountered: