Coming soon - Get a detailed view of why an account is flagged as spam!
view details

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

2
Ionic 4 change detection - not working as it did in V3 or any of my Angular apps
Post Body

I have added a small datastore to my ionic app which is essentially built upon beahviourSubject. I use this method in all of my Angular apps from V2 onwards and in all my previous Ionic 3 apps - never had an issue.

I have just built my first Ionic 4 app and now that I am running two users in conjunction I am seeing some weird behaviour.

Any standard page i.e created with ionic g page pages/myPageName does not have it's UI updated as data is pushed to the datastore

Any standard component created with ionic g component /components/myComponentName does have the UI updated as soon as the datastore changes.

This is very weird and worrying as I have the have this build completed tomorrow and this is a last moment potential disaster. Has change detection changed from V3 to V4? Does Ionic depart from the standard Angular change detection?

any help greatly appreciated.

example code:

In my page I add this above the constructor to create the observable:

import {Store} from '../../store';

user$ = this.store.select<any>('user')

constructor(private store: Store) {}

my store.ts

import {pluck, distinctUntilChanged} from 'rxjs/operators';import {BehaviorSubject, Observable} from 'rxjs';import {State} from './state';const state: State = {user: undefined, ... and others}

export class Store {private subject = new BehaviorSubject<State>(state);private store = this.subject.asObservable().pipe(distinctUntilChanged());get value() {return this.subject.value;}select<T>(name: string): Observable<T> {return this.store.pipe(pluck(name));}selectForLocal(name: string) {const d = this.subject.value;return d[name];}set(name: string, state: any) {this.subject.next({...this.value, [name]: state});}}

Author
Account Strength
90%
Account Age
7 years
Verified Email
Yes
Verified Flair
No
Total Karma
691
Link Karma
293
Comment Karma
398
Profile updated: 1 day ago
Posts updated: 2 months ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
5 years ago