Skip to content

Commit

Permalink
fix: wrong value on data export (#78)
Browse files Browse the repository at this point in the history
  • Loading branch information
kohii committed Mar 1, 2024
1 parent b4e84ab commit 8c8995f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/features/exports/use-export-data.ts
Expand Up @@ -23,9 +23,9 @@ export function useExportData(
switch (f.kind) {
case "normal": {
const { seq, options: option } = f;
const field = getFieldBySeq(seq);
const field = getFieldBySeq(seq)!;

if (field?.codes) {
if (field.codes) {
const variant = option?.variant ?? "label-with-code";
if (variant === "label") {
return getCodeLabel(row, field) ?? "";
Expand All @@ -35,7 +35,7 @@ export function useExportData(
}
return `${getValue(row, field)}: ${getCodeLabel(row, field)}`;
}
return `${seq}`;
return getValue(row, field);
}
case "virtual": {
const { key } = f;
Expand Down Expand Up @@ -96,9 +96,9 @@ export function useExportData(
a.download = "data.csv";
a.click();
},
copy() {
async copy() {
const csv = stringifyRows();
copyToClipboard(csv);
await copyToClipboard(csv);
}
};
}, [stringifyRows]);
Expand Down

0 comments on commit 8c8995f

Please sign in to comment.