Fix page reload navigation and add more debugging
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone Build is passing

This commit is contained in:
Garrett Mills 2020-12-23 21:14:43 -06:00
parent bbb727bd38
commit 0c93860816
Signed by: garrettmills
GPG Key ID: D2BF5FBA8298F246
3 changed files with 16 additions and 0 deletions

View File

@ -192,6 +192,8 @@ export class AppComponent implements OnInit {
const id = node.data.id; const id = node.data.id;
const nodeId = node.data.node_id; const nodeId = node.data.node_id;
if ( !node.data.virtual ) { if ( !node.data.virtual ) {
debug('Navigating editor to node:', {id, nodeId});
this.currentPageId = id; this.currentPageId = id;
this.router.navigate(['/editor', { id, ...(nodeId ? { node_id: nodeId } : {}) }]); this.router.navigate(['/editor', { id, ...(nodeId ? { node_id: nodeId } : {}) }]);
} }
@ -608,6 +610,12 @@ export class AppComponent implements OnInit {
}); });
this.navService.navigationRequest$.subscribe(pageId => { this.navService.navigationRequest$.subscribe(pageId => {
debug('Page navigation request: ', {pageId});
if ( !pageId ) {
debug('Empty page ID. Will not navigate.');
return;
}
this.currentPageId = pageId; this.currentPageId = pageId;
this.router.navigate(['/editor', { id: pageId }]); this.router.navigate(['/editor', { id: pageId }]);
}); });

View File

@ -43,6 +43,8 @@ export class EditorPage implements OnInit {
protected modals: ModalController, protected modals: ModalController,
public readonly editorService: EditorService, public readonly editorService: EditorService,
) { ) {
debug('Constructed editor page.');
this.route.params.subscribe(params => { this.route.params.subscribe(params => {
this.pageId = params.id; this.pageId = params.id;
debug('Got page ID from route:', this.pageId, params); debug('Got page ID from route:', this.pageId, params);
@ -54,6 +56,8 @@ export class EditorPage implements OnInit {
ngOnInit() {} ngOnInit() {}
ionViewDidEnter() { ionViewDidEnter() {
debug('Ion view did enter editor page.');
if ( this.pageId ) { if ( this.pageId ) {
this.editorService.startEditing(this.pageId, this.version); this.editorService.startEditing(this.pageId, this.version);
} else if ( !this.hosted ) { } else if ( !this.hosted ) {

View File

@ -1,5 +1,6 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import {BehaviorSubject} from 'rxjs'; import {BehaviorSubject} from 'rxjs';
import {debug} from '../utility';
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
@ -15,6 +16,9 @@ export class NavigationService {
} }
requestNavigation(pageId: string) { requestNavigation(pageId: string) {
debug('Requesting page navigation:', pageId);
debug('Page navigation trace', new Error());
this.navigationRequest$.next(pageId); this.navigationRequest$.next(pageId);
} }
} }