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

fix: large list performance #55

Merged
merged 5 commits into from
Mar 23, 2024
Merged

fix: large list performance #55

merged 5 commits into from
Mar 23, 2024

Conversation

huntabyte
Copy link
Owner

@huntabyte huntabyte commented Feb 4, 2024

Closes: #45

This PR cleans up a few of the internals that would cause the page to crash if a large list was rendered. There is still a slight delay at the beginning of typing when trying to filter a large list that I haven't been able to solve just yet. Some of these things may be related to the DOM updates that have to occur.

I'd be thrilled if someone else could take a look into how we can make that seamless as well, but this is enough of an improvement to merge for the time being.

Copy link

changeset-bot bot commented Feb 4, 2024

🦋 Changeset detected

Latest commit: 4ae58fd

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
cmdk-sv Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Feb 4, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
cmdk-sv ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 23, 2024 6:42pm

@FredrikAugust
Copy link

Hey! Any updates on this one? We're currently trying to render a list of ~500 elements, and it's currently hanging for a couple of seconds when we try to filter:)

@rogerfar
Copy link

rogerfar commented Mar 6, 2024

Unfortunately we ran into the same issue, list with only 200 items takes about 2-3 seconds for the search to hang.

@MadeInPierre
Copy link

MadeInPierre commented Mar 23, 2024

Hi! Just here to also say that my ~500 items list freezes the page with 100% CPU for ~5 seconds, unfortunately I don't have the skills to propose a fix myself.

Has anyone found a temporary workaround ? Even setting filter={() => 1} to attempt to bypass the built-in search algorithm does not have any effect.

@rogerfar
Copy link

rogerfar commented Mar 23, 2024

Has anyone found a temporary workaround ? Event setting filter={() => 1} to attempt to bypass the built-in search algorithm does not have any effect.

I use customer filtering on the datasource which works perfect.

$: search = '';
$: groups = dataSource.filter(m => m.filter((m) => m.name.includes(search)

<Command.Input placeholder="Search..." bind:value={search} />
...
{#each groups as group}
    <Command.Item value={group.groupId}>{group.name}</Command.Item>
{/each}

@huntabyte huntabyte merged commit 02572ab into main Mar 23, 2024
4 checks passed
@huntabyte huntabyte deleted the fix/speed branch March 23, 2024 18:44
@github-actions github-actions bot mentioned this pull request Mar 23, 2024
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.

Large Command.List cannot be filtered w/o crashing
4 participants