fix pasting in search bar after page load showing no results

This commit is contained in:
undergroundwires
2020-09-16 01:59:11 +01:00
parent 6efed72bf2
commit d169434157
6 changed files with 156 additions and 118 deletions

View File

@@ -49,6 +49,7 @@
state.filter.filtered.on(this.handleFiltered);
// Update initial state
await this.initializeNodesAsync(this.categoryId);
await this.initializeFilter(state.filter.currentFilter);
}
public async toggleNodeSelectionAsync(event: INodeSelectedEvent) {
@@ -84,6 +85,14 @@
(category: ICategory) => node.id === getCategoryNodeId(category));
}
private initializeFilter(currentFilter: IFilterResult | undefined) {
if (!currentFilter) {
this.handleFilterRemoved();
} else {
this.handleFiltered(currentFilter);
}
}
private handleSelectionChanged(selectedScripts: ReadonlyArray<SelectedScript>): void {
this.selectedNodeIds = selectedScripts
.map((node) => node.id);

View File

@@ -35,7 +35,7 @@
Node,
},
})
export default class SelectableTree extends Vue {
export default class SelectableTree extends Vue { // Keep it stateless to make it easier to switch out
@Prop() public filterPredicate?: FilterPredicate;
@Prop() public filterText?: string;
@Prop() public selectedNodeIds?: ReadonlyArray<string>;

View File

@@ -72,7 +72,6 @@
public isSearching = false;
public searchHasMatches = false;
public async mounted() {
const state = await this.getCurrentStateAsync();
this.repositoryUrl = state.app.repositoryUrl;