How to use @devexperts/remote-data-ts - 10 common examples

To help you get started, we’ve selected a few @devexperts/remote-data-ts examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github devexperts / dx-platform / packages / react-kit / src / components / render-remote-data / render-remote-data.component.tsx View on Github external
public render() {
		const { data } = this.props;
		return (
			
				{isPending(data) && this.renderPending()}
				{isSuccess(data) && this.renderSuccess(data.value)}
				{isFailure(data) && this.renderFailure(data.error)}
			
		);
	}
github devexperts / dx-platform / packages / rx-utils / src / rd / entity-store.utils.ts View on Github external
			switchMap(data => (isSuccess(data) ? this._getAllValues$ : of(data))),
			distinctUntilChanged(),
github devexperts / dx-platform / packages / rx-utils / src / rd / entity-store.utils.ts View on Github external
tap(value => {
				if (isSuccess(value)) {
					this.cache.set(key, value);
				}
			}),
		);
github devexperts / dx-platform / packages / rx-utils / src / rd / entity-store.utils.ts View on Github external
		map(data => data.filter(item => isSuccess(item))),
		map(array.sequence(remoteData)),
github devexperts / dx-platform / packages / rx-utils / src / rd / entity-store.utils.ts View on Github external
get(key: string, get: () => LiveData): LiveData {
		let sharedGetter: Observable> | undefined = this.cachedStreams.get(key);

		if (!isNotNullable(sharedGetter)) {
			const hasValue = this.cache.has(key);
			const cachedValue = this.cache.getValue(key);
			const valueIsResolved = isNotNullable(cachedValue) && isSuccess(cachedValue);
			if (hasValue && valueIsResolved) {
				return this.cache.get(key);
			}

			sharedGetter = new Observable>(observer => {
				const getterSubscription = get().subscribe(value => {
					this.cache.set(key, value);
				});

				const cacheSubscription = this.cache.get(key).subscribe(value => {
					observer.next(value);
				});

				return () => {
					getterSubscription.unsubscribe();
					cacheSubscription.unsubscribe();
github devexperts / dx-platform / packages / rx-utils / src / rd / entity-store.utils.ts View on Github external
switchMapRD(value => {
				const key = pk(value);
				this.cache.set(key, success(value));
				return this.cache.get(key);
			}),
		);