mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-07-14 14:00:31 +03:00
console: fix invalid query analyse data issue
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/10905 GitOrigin-RevId: 402789fe807f192c841b12ea4ec322207fc861ae
This commit is contained in:
parent
b5cf229dad
commit
e5f4cf85ba
@ -47,7 +47,9 @@ export default class QueryAnalyser extends React.Component {
|
|||||||
.then(data => {
|
.then(data => {
|
||||||
// todo: unsure if this guard is necessary. Replaces previous guard that would silently return
|
// todo: unsure if this guard is necessary. Replaces previous guard that would silently return
|
||||||
// this was previously necessary as the analyze fetcher would handle errors without throwing
|
// this was previously necessary as the analyze fetcher would handle errors without throwing
|
||||||
if (!data) {
|
const isNotValidData =
|
||||||
|
data && data[0]?.plan === null && data[0]?.sql === null;
|
||||||
|
if (isNotValidData) {
|
||||||
console.error(
|
console.error(
|
||||||
'Missing data from analyze result. This should never happen.'
|
'Missing data from analyze result. This should never happen.'
|
||||||
);
|
);
|
||||||
@ -70,7 +72,7 @@ export default class QueryAnalyser extends React.Component {
|
|||||||
<Modal
|
<Modal
|
||||||
className="flex flex-col p-10 rounded-xl w-full z-[101]"
|
className="flex flex-col p-10 rounded-xl w-full z-[101]"
|
||||||
overlayClassName="fixed top-0 left-0 right-0 bottom-6 bg-white bg-opacity-75 z-[101]"
|
overlayClassName="fixed top-0 left-0 right-0 bottom-6 bg-white bg-opacity-75 z-[101]"
|
||||||
isOpen={show && this.state.analyseData.length > 0}
|
isOpen={show && !!this.state?.analyseData?.length}
|
||||||
>
|
>
|
||||||
<div className="bg-[#43495a] border-b border-gray-200 py-sm px-md flex justify-between">
|
<div className="bg-[#43495a] border-b border-gray-200 py-sm px-md flex justify-between">
|
||||||
<div className="font-xl font-bold text-[#ffc627]">Query Analysis</div>
|
<div className="font-xl font-bold text-[#ffc627]">Query Analysis</div>
|
||||||
@ -118,7 +120,7 @@ export default class QueryAnalyser extends React.Component {
|
|||||||
dangerouslySetInnerHTML={{
|
dangerouslySetInnerHTML={{
|
||||||
__html:
|
__html:
|
||||||
this.state.activeNode >= 0 &&
|
this.state.activeNode >= 0 &&
|
||||||
this.state.analyseData.length > 0 &&
|
!!this.state?.analyseData?.length &&
|
||||||
hljs.highlight(
|
hljs.highlight(
|
||||||
'sql',
|
'sql',
|
||||||
sqlFormatter.format(
|
sqlFormatter.format(
|
||||||
@ -156,7 +158,7 @@ export default class QueryAnalyser extends React.Component {
|
|||||||
</Button>
|
</Button>
|
||||||
<code>
|
<code>
|
||||||
{this.state.activeNode >= 0 &&
|
{this.state.activeNode >= 0 &&
|
||||||
this.state.analyseData.length > 0
|
!!this.state?.analyseData?.length
|
||||||
? this.state.analyseData[
|
? this.state.analyseData[
|
||||||
this.state.activeNode
|
this.state.activeNode
|
||||||
].plan.join('\n')
|
].plan.join('\n')
|
||||||
|
Loading…
Reference in New Issue
Block a user