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(QueryResultTable): fix table error on null cell sort #590

Merged
merged 1 commit into from
Nov 16, 2023

Conversation

artemmufazalov
Copy link
Member

viewer/json/query returns null for empty table cells.

If type of table value was 'object', it was converted to string. But typeof null === 'object'.

Check if (value === null) didn't work because null was a string. However, when passed to BigInt, it was further converted that caused an error, table was stuck in invalid state.

Because of this issue sorting in Preview table could lead to SyntaxError (displayed on the screen).

To fix it, I prevent converting null to string, when data is initially parsed.

Screen Shot 2023-11-16 at 17 11 28

return columnType === 'number' ? BigInt(value) : value;
},
render: ({value}) => <Cell value={value as string} />,
render: ({row}) => <Cell value={String(row[name])} />,
Copy link
Member Author

Choose a reason for hiding this comment

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

value type is always unknown. So I extract value from typed row value

@artemmufazalov artemmufazalov marked this pull request as ready for review November 16, 2023 14:19
@artemmufazalov artemmufazalov merged commit 805a339 into main Nov 16, 2023
4 checks passed
@artemmufazalov artemmufazalov deleted the fix-preview-table-sort branch November 16, 2023 15:08
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.

2 participants