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

refactor: migrate ExecuteResult to ts #561

Merged
merged 3 commits into from
Oct 19, 2023
Merged

Conversation

artemmufazalov
Copy link
Member

No description provided.

@@ -14,14 +14,14 @@ const b = cn('kv-query-execution-status');

interface QueryExecutionStatusProps {
className?: string;
error?: AxiosError | Record<string, any>;
error?: AxiosError | Record<string, any> | string;
Copy link
Member Author

@artemmufazalov artemmufazalov Oct 18, 2023

Choose a reason for hiding this comment

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

I didn't remove Record<string, any>, it seems the case with aborted connection error isn't covered by types yet. I plan to reconsider it later, when full components chain will be converted to TS (Query -> QueryEditor -> ExecuteResult && ExplainResult)

Copy link
Contributor

Choose a reason for hiding this comment

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

lets add TODO: to not forget?

const hasIssues = error?.data?.issues && Array.isArray(error.data.issues);

if (hasIssues) {
if (typeof error === 'object' && error?.data?.issues && Array.isArray(error.data.issues)) {
Copy link
Member Author

@artemmufazalov artemmufazalov Oct 18, 2023

Choose a reason for hiding this comment

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

TS doesn't type data correctly, when this condition is a separate variable

}

export default function ResultIssues({data, className}: ResultIssuesProps) {
Copy link
Member Author

Choose a reason for hiding this comment

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

className wasn't used

@artemmufazalov artemmufazalov marked this pull request as ready for review October 18, 2023 14:56
Raubzeug
Raubzeug previously approved these changes Oct 18, 2023
@@ -14,14 +14,14 @@ const b = cn('kv-query-execution-status');

interface QueryExecutionStatusProps {
className?: string;
error?: AxiosError | Record<string, any>;
error?: AxiosError | Record<string, any> | string;
Copy link
Contributor

Choose a reason for hiding this comment

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

lets add TODO: to not forget?

}

return null;
Copy link
Contributor

Choose a reason for hiding this comment

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

let's move it to the beginning of the function, just for easier reading?

const hasIssues = error?.data?.issues && Array.isArray(error.data.issues);

if (hasIssues) {
if (typeof error === 'object' && error?.data?.issues && Array.isArray(error.data.issues)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

if we start function from

if (!error) {
return null}

it will be no need in ? after error

@artemmufazalov artemmufazalov merged commit ca23c14 into main Oct 19, 2023
4 checks passed
@artemmufazalov artemmufazalov deleted the execute-result-in-ts branch October 19, 2023 08:05
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