Added re-emission of latest query when search is ready

This commit is contained in:
squidfunk 2020-04-26 17:41:00 +02:00
parent b5be7d3971
commit 62fcc9b86e
16 changed files with 42 additions and 28 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,12 +1,12 @@
{ {
"assets/javascripts/bundle.js": "assets/javascripts/bundle.37a8e348.min.js", "assets/javascripts/bundle.js": "assets/javascripts/bundle.5482c854.min.js",
"assets/javascripts/bundle.js.map": "assets/javascripts/bundle.37a8e348.min.js.map", "assets/javascripts/bundle.js.map": "assets/javascripts/bundle.5482c854.min.js.map",
"assets/javascripts/vendor.js": "assets/javascripts/vendor.d1e549c9.min.js", "assets/javascripts/vendor.js": "assets/javascripts/vendor.ff4ef43d.min.js",
"assets/javascripts/vendor.js.map": "assets/javascripts/vendor.d1e549c9.min.js.map", "assets/javascripts/vendor.js.map": "assets/javascripts/vendor.ff4ef43d.min.js.map",
"assets/javascripts/worker/search.js": "assets/javascripts/worker/search.58d22e8e.min.js", "assets/javascripts/worker/search.js": "assets/javascripts/worker/search.58d22e8e.min.js",
"assets/javascripts/worker/search.js.map": "assets/javascripts/worker/search.58d22e8e.min.js.map", "assets/javascripts/worker/search.js.map": "assets/javascripts/worker/search.58d22e8e.min.js.map",
"assets/stylesheets/main.css": "assets/stylesheets/main.bc24890a.min.css", "assets/stylesheets/main.css": "assets/stylesheets/main.c3c42cb5.min.css",
"assets/stylesheets/main.css.map": "assets/stylesheets/main.bc24890a.min.css.map", "assets/stylesheets/main.css.map": "assets/stylesheets/main.c3c42cb5.min.css.map",
"assets/stylesheets/palette.css": "assets/stylesheets/palette.883290b5.min.css", "assets/stylesheets/palette.css": "assets/stylesheets/palette.b88dff20.min.css",
"assets/stylesheets/palette.css.map": "assets/stylesheets/palette.883290b5.min.css.map" "assets/stylesheets/palette.css.map": "assets/stylesheets/palette.b88dff20.min.css.map"
} }

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -41,9 +41,9 @@
{% endif %} {% endif %}
{% endblock %} {% endblock %}
{% block styles %} {% block styles %}
<link rel="stylesheet" href="{{ 'assets/stylesheets/main.bc24890a.min.css' | url }}"> <link rel="stylesheet" href="{{ 'assets/stylesheets/main.c3c42cb5.min.css' | url }}">
{% if palette.primary or palette.accent %} {% if palette.primary or palette.accent %}
<link rel="stylesheet" href="{{ 'assets/stylesheets/palette.883290b5.min.css' | url }}"> <link rel="stylesheet" href="{{ 'assets/stylesheets/palette.b88dff20.min.css' | url }}">
{% endif %} {% endif %}
{% if palette.primary %} {% if palette.primary %}
{% import "partials/palette.html" as map %} {% import "partials/palette.html" as map %}
@ -178,8 +178,8 @@
{% endblock %} {% endblock %}
</div> </div>
{% block scripts %} {% block scripts %}
<script src="{{ 'assets/javascripts/vendor.d1e549c9.min.js' | url }}"></script> <script src="{{ 'assets/javascripts/vendor.ff4ef43d.min.js' | url }}"></script>
<script src="{{ 'assets/javascripts/bundle.37a8e348.min.js' | url }}"></script> <script src="{{ 'assets/javascripts/bundle.5482c854.min.js' | url }}"></script>
{%- set translations = {} -%} {%- set translations = {} -%}
{%- for key in [ {%- for key in [
"clipboard.copy", "clipboard.copy",

View File

@ -25,14 +25,18 @@ import {
filter, filter,
map, map,
mapTo, mapTo,
pluck,
sample,
startWith, startWith,
switchMap switchMap,
take
} from "rxjs/operators" } from "rxjs/operators"
import { WorkerHandler } from "browser" import { WorkerHandler } from "browser"
import { import {
SearchMessage, SearchMessage,
SearchResult, SearchResult,
isSearchQueryMessage,
isSearchReadyMessage isSearchReadyMessage
} from "integrations/search" } from "integrations/search"
@ -86,7 +90,7 @@ interface MountOptions {
* @return Operator function * @return Operator function
*/ */
export function mountSearch( export function mountSearch(
{ rx$ }: WorkerHandler<SearchMessage>, { rx$, tx$ }: WorkerHandler<SearchMessage>,
{ query$, reset$, result$ }: MountOptions { query$, reset$, result$ }: MountOptions
): OperatorFunction<HTMLElement, Search> { ): OperatorFunction<HTMLElement, Search> {
return pipe( return pipe(
@ -100,6 +104,16 @@ export function mountSearch(
startWith("waiting") startWith("waiting")
) as Observable<SearchStatus> ) as Observable<SearchStatus>
/* Re-emit the latest query when search is ready */
tx$
.pipe(
filter(isSearchQueryMessage),
sample(status$),
take(1),
filter(({ data }) => data.length > 0)
)
.subscribe(tx$.next.bind(tx$))
/* Combine into single observable */ /* Combine into single observable */
return combineLatest([status$, query$, result$, reset$]) return combineLatest([status$, query$, result$, reset$])
.pipe( .pipe(