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

Ensure paginate updates when samples value changes in Dataset #7761

Merged
merged 2 commits into from Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/young-ants-build.md
@@ -0,0 +1,6 @@
---
"@gradio/dataset": patch
"gradio": patch
---

fix:Ensure `paginate` updates when samples value changes in `Dataset`
26 changes: 14 additions & 12 deletions js/dataset/Index.svelte
Expand Up @@ -51,6 +51,7 @@
}

$: {
paginate = samples.length > samples_per_page;
if (paginate) {
visible_pages = [];
selected_samples = samples.slice(
Expand Down Expand Up @@ -83,18 +84,19 @@

async function get_component_meta(selected_samples: any[][]): Promise<void> {
component_meta = await Promise.all(
selected_samples.map(
async (sample_row) =>
await Promise.all(
sample_row.map(async (sample_cell, j) => {
return {
value: sample_cell,
component: (await component_map.get(components[j]))
?.default as ComponentType<SvelteComponent>
};
})
)
)
selected_samples &&
selected_samples.map(
async (sample_row) =>
await Promise.all(
sample_row.map(async (sample_cell, j) => {
return {
value: sample_cell,
component: (await component_map.get(components[j]))
?.default as ComponentType<SvelteComponent>
};
})
)
)
);
}

Expand Down