Skip to content

Commit 2fd7cb8

Browse files
atwalg2jasonLaster
authored andcommitted
[QuickOpen] show indicator if symbols are still being parsed (firefox-devtools#5371)
1 parent 368c04e commit 2fd7cb8

3 files changed

Lines changed: 32 additions & 9 deletions

File tree

src/components/QuickOpenModal.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,8 @@
1111
.theme-dark .result-item .subtitle .highlight {
1212
color: white;
1313
}
14+
15+
.loading-indicator {
16+
padding: 5px 0 5px 0;
17+
text-align: center;
18+
}

src/components/QuickOpenModal.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -357,10 +357,8 @@ export class QuickOpenModal extends Component<Props, State> {
357357
return !this.getResultCount() && !!query;
358358
}
359359

360-
hasPrefix = () => /^[:#@]/.test(this.props.query);
361-
362360
render() {
363-
const { enabled, query } = this.props;
361+
const { enabled, query, symbols } = this.props;
364362
const { selectedIndex, results } = this.state;
365363

366364
if (!enabled) {
@@ -380,12 +378,17 @@ export class QuickOpenModal extends Component<Props, State> {
380378
onChange={this.onChange}
381379
onKeyDown={this.onKeyDown}
382380
handleClose={this.closeModal}
383-
hasPrefix={this.hasPrefix()}
384381
expanded={expanded}
385382
selectedItemId={
386383
expanded && items[selectedIndex] ? items[selectedIndex].id : ""
387384
}
388385
/>
386+
{!symbols ||
387+
(symbols.functions.length == 0 && (
388+
<div className="loading-indicator">
389+
{L10N.getStr("loadingText")}
390+
</div>
391+
))}
389392
{newResults && (
390393
<ResultList
391394
key="results"

src/components/tests/__snapshots__/QuickOpenModal.spec.js.snap

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ exports[`QuickOpenModal Basic render with mount & searchType = functions 1`] = `
5454
count={0}
5555
expanded={false}
5656
handleClose={[Function]}
57-
hasPrefix={true}
57+
hasPrefix={false}
5858
onChange={[Function]}
5959
onKeyDown={[Function]}
6060
placeholder="Search sources…"
@@ -117,6 +117,11 @@ exports[`QuickOpenModal Basic render with mount & searchType = functions 1`] = `
117117
</CloseButton>
118118
</div>
119119
</SearchInput>
120+
<div
121+
className="loading-indicator"
122+
>
123+
Loading…
124+
</div>
120125
<ResultList
121126
expanded={false}
122127
items={Array []}
@@ -195,7 +200,7 @@ exports[`QuickOpenModal Basic render with mount & searchType = variables 1`] = `
195200
count={0}
196201
expanded={false}
197202
handleClose={[Function]}
198-
hasPrefix={true}
203+
hasPrefix={false}
199204
onChange={[Function]}
200205
onKeyDown={[Function]}
201206
placeholder="Search sources…"
@@ -258,6 +263,11 @@ exports[`QuickOpenModal Basic render with mount & searchType = variables 1`] = `
258263
</CloseButton>
259264
</div>
260265
</SearchInput>
266+
<div
267+
className="loading-indicator"
268+
>
269+
Loading…
270+
</div>
261271
<ResultList
262272
expanded={false}
263273
items={Array []}
@@ -504,7 +514,7 @@ exports[`QuickOpenModal Simple goto search query = :abc & searchType = goto 1`]
504514
count={0}
505515
expanded={false}
506516
handleClose={[Function]}
507-
hasPrefix={true}
517+
hasPrefix={false}
508518
onChange={[Function]}
509519
onKeyDown={[Function]}
510520
placeholder="Search sources…"
@@ -567,6 +577,11 @@ exports[`QuickOpenModal Simple goto search query = :abc & searchType = goto 1`]
567577
</CloseButton>
568578
</div>
569579
</SearchInput>
580+
<div
581+
className="loading-indicator"
582+
>
583+
Loading…
584+
</div>
570585
</div>
571586
</div>
572587
</Modal>
@@ -965,7 +980,7 @@ exports[`QuickOpenModal showErrorEmoji false when goto numeric ':2222' 1`] = `
965980
count={0}
966981
expanded={false}
967982
handleClose={[Function]}
968-
hasPrefix={true}
983+
hasPrefix={false}
969984
onChange={[Function]}
970985
onKeyDown={[Function]}
971986
placeholder="Search sources…"
@@ -1219,7 +1234,7 @@ exports[`QuickOpenModal showErrorEmoji true when goto not numeric ':22k22' 1`] =
12191234
count={0}
12201235
expanded={false}
12211236
handleClose={[Function]}
1222-
hasPrefix={true}
1237+
hasPrefix={false}
12231238
onChange={[Function]}
12241239
onKeyDown={[Function]}
12251240
placeholder="Search sources…"

0 commit comments

Comments
 (0)