Skip to content

Commit

Permalink
Merge pull request #5934 from dodona-edu/fix/eager-search
Browse files Browse the repository at this point in the history
Only perform eager search after url is set
  • Loading branch information
jorg-vr authored Nov 14, 2024
2 parents 214ff5a + 1712e06 commit 26e1e98
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
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

0 comments on commit 26e1e98

Please sign in to comment.