File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -124,6 +124,18 @@ function Sandbox() {
124
124
) ;
125
125
}
126
126
127
+ function checkQuery ( queries ) {
128
+ const suggestions = Object . values ( queries ) . filter ( Boolean ) ;
129
+ const suggestion = Object . values ( queries ) . find ( Boolean ) ;
130
+
131
+ const anotherSuggestion = suggestions . find (
132
+ ( query ) =>
133
+ query ?. queryName && ! query . snippet ?. startsWith ( '// sorry, I failed' ) ,
134
+ ) ;
135
+
136
+ return anotherSuggestion ? anotherSuggestion : suggestion ;
137
+ }
138
+
127
139
function onSelectNode ( node , { origin } ) {
128
140
// onSelectNode can be triggered after onMouseLeave has already been called.
129
141
// This makes it impossible to clear hover state. That's why we maintain and
@@ -138,7 +150,8 @@ function onSelectNode(node, { origin }) {
138
150
rootNode : state . rootNode ,
139
151
} ) ;
140
152
141
- const suggestion = Object . values ( queries ) . find ( Boolean ) ;
153
+ const suggestion = checkQuery ( queries ) ;
154
+
142
155
if ( ! suggestion ) {
143
156
return ;
144
157
}
You can’t perform that action at this time.
0 commit comments