-
Notifications
You must be signed in to change notification settings - Fork 9
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
Conversation
@@ -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; |
There was a problem hiding this comment.
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
)
There was a problem hiding this comment.
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)) { |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
className
wasn't used
@@ -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; |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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)) { |
There was a problem hiding this comment.
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
No description provided.