Skip to content

Commit

Permalink
Merge pull request #1011 from datopian/fix-flatui
Browse files Browse the repository at this point in the history
Fix flatui
  • Loading branch information
demenech committed Aug 15, 2023
2 parents b2b4fbd + 8e89613 commit 8c5c6a2
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/lovely-ghosts-sin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@portaljs/components': patch
---

fix bug when there were multiple flatuitable components at the same time
5 changes: 5 additions & 0 deletions .changeset/rare-pianos-repair.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@portaljs/ckan': patch
---

added package_count to organization type
Binary file removed packages/components/portaljs-components-0.1.12.tgz
Binary file not shown.
15 changes: 12 additions & 3 deletions packages/components/src/components/FlatUiTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,25 @@ export interface FlatUiTableProps {
data?: { [key: string]: number | string }[];
rawCsv?: string;
corsProxy?: string;
randomId?: number;
}
export const FlatUiTable: React.FC<FlatUiTableProps> = ({
url,
data,
rawCsv,
corsProxy,
}) => {
const randomId = Math.random();
return (
// Provide the client to your App
<QueryClientProvider client={queryClient}>
<TableInner corsProxy={corsProxy} url={url} data={data} rawCsv={rawCsv} />
<TableInner
corsProxy={corsProxy}
url={url}
data={data}
rawCsv={rawCsv}
randomId={randomId}
/>
</QueryClientProvider>
);
};
Expand All @@ -62,6 +70,7 @@ const TableInner: React.FC<FlatUiTableProps> = ({
data,
rawCsv,
corsProxy,
randomId,
}) => {
if (data) {
return (
Expand All @@ -71,12 +80,12 @@ const TableInner: React.FC<FlatUiTableProps> = ({
);
}
const { data: csvString, isLoading: isDownloadingCSV } = useQuery(
['dataCsv', url],
['dataCsv', url, randomId],
() => getCsv(url as string, corsProxy),
{ enabled: !!url }
);
const { data: parsedData, isLoading: isParsing } = useQuery(
['dataPreview', csvString],
['dataPreview', csvString, randomId],
() => parseCsv(rawCsv ? (rawCsv as string) : (csvString as string)),
{ enabled: rawCsv ? true : !!csvString }
);
Expand Down

1 comment on commit 8c5c6a2

@vercel
Copy link

@vercel vercel bot commented on 8c5c6a2 Aug 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

portaljs-storybook – ./packages/components/

portaljs-storybook-git-main-datopian1.vercel.app
portaljs-storybook.vercel.app
portaljs-storybook-datopian1.vercel.app
storybook.portaljs.org

Please sign in to comment.