diff --git a/src/src/app/models/card-state.ts b/src/src/app/models/card-state.ts index d47a9f96..9fe420de 100644 --- a/src/src/app/models/card-state.ts +++ b/src/src/app/models/card-state.ts @@ -13,12 +13,6 @@ export enum CardType { Error, } -export interface CardItem { - readonly qry: string; - readonly data: CardData; - readonly type: CardType; -} - export interface CardIcons { readonly words: string; readonly passage: string; @@ -26,3 +20,12 @@ export interface CardIcons { readonly note: string; readonly savedPage: string; } + +export interface DataReference { + readonly qry: string; + readonly type: CardType; +} + +export interface CardItem extends DataReference { + readonly data: CardData; +} diff --git a/src/src/app/pages/search/search.page.ts b/src/src/app/pages/search/search.page.ts index 1fac21b1..63f0749e 100644 --- a/src/src/app/pages/search/search.page.ts +++ b/src/src/app/pages/search/search.page.ts @@ -58,6 +58,7 @@ export class SearchPage extends SubscriberBase implements OnInit { ); this.init(); + // subscribe to autocomplete input control's changes this.addSubscription( this.searchControl.valueChanges.subscribe((value: string) => this.appService.getAutoComplete(value.toLowerCase())) @@ -77,12 +78,14 @@ export class SearchPage extends SubscriberBase implements OnInit { this.navService.closeNav(); // close the nav immediately. } - // monitor the saved paged loaded property, and fire the action once it turns true, then stop. + // monitor the saved paged loaded property, + // and fire the action once it turns true, then stop. onSavedPagedLoaded(id: string) { if (this.savedPagedLoaded) { this.appService.getSavedPage(id); - return; + return; // you did it! stop trying. } + // the saved page hasn't loaded yet, wait then try again. setTimeout(() => { this.onSavedPagedLoaded(id); }, 100); diff --git a/src/src/app/services/app-state-reducer.ts b/src/src/app/services/app-state-reducer.ts index 5a73f810..77c7a60a 100644 --- a/src/src/app/services/app-state-reducer.ts +++ b/src/src/app/services/app-state-reducer.ts @@ -240,6 +240,8 @@ export function reducer(state: AppState, action: AppAction): AppState { //#endregion + //#region Cards + case 'ADD_CARD': { let cards = []; @@ -315,6 +317,9 @@ export function reducer(state: AppState, action: AppAction): AppState { cards, }; } + + //#endregion + case 'SET_USER': { return { ...state,