Skip to content
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

Only perform eager search after url is set #5934

Merged
merged 4 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions app/assets/javascripts/components/search/search_field.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,6 @@ export class SearchFieldSuggestion extends FilterElement {
export class SearchField extends FilterCollection {
@property({ type: String })
placeholder: string;
@property({ type: Boolean })
eager: boolean;

@property({ state: true })
filter?: string = "";
Expand Down Expand Up @@ -110,13 +108,6 @@ export class SearchField extends FilterCollection {
setFilter();
}

update(changedProperties: Map<string, unknown>): void {
if (changedProperties.has("eager") && this.eager) {
search.search();
}
super.update(changedProperties);
}

keydown(e: KeyboardEvent): void {
if (e.key === "Tab") {
e.preventDefault();
Expand Down
5 changes: 4 additions & 1 deletion app/views/layouts/_searchbar.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
<i class="mdi mdi-magnify"></i>
<form class='search' onsubmit="return false;">
<d-search-field placeholder="<%= t("layout.search.search") %>"
eager="<%= local_assigns.fetch :eager, false %>"
hide="<%= no_filter_for.to_json %>"
></d-search-field>
<d-loading-bar search-based></d-loading-bar>
Expand Down Expand Up @@ -49,5 +48,9 @@
dodona.search.setLocalStorageKey(localStorageKey);

dodona.search.updateFilters(<%= raw json_escape(@filters.to_json) %>);

<% if local_assigns.fetch :eager, false %>
dodona.search.search();
<% end %>
});
</script>
1 change: 1 addition & 0 deletions app/views/series/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<div class="col-sm-9">
<div class="d-flex" id="access_token_field">
<%= render partial: 'token_field',
formats: [:html],
locals: {
name: :access_token,
value: series_url(@series, token: @series.access_token),
Expand Down