also skip loading hal requests

This commit is contained in:
Art Lowel
2023-12-01 16:19:12 +01:00
parent 38752d9d71
commit c8ac260b78

View File

@@ -6,7 +6,6 @@ import { hasValue, isEmpty, isNotEmpty } from '../../shared/empty.util';
import { RESTURLCombiner } from '../url-combiner/rest-url-combiner'; import { RESTURLCombiner } from '../url-combiner/rest-url-combiner';
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { EndpointMap } from '../cache/response.models'; import { EndpointMap } from '../cache/response.models';
import { getFirstCompletedRemoteData } from './operators';
import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service'; import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
import { RemoteData } from '../data/remote-data'; import { RemoteData } from '../data/remote-data';
import { CacheableObject } from '../cache/cacheable-object.model'; import { CacheableObject } from '../cache/cacheable-object.model';
@@ -37,8 +36,8 @@ export class HALEndpointService {
// This skip ensures that if a stale object is present in the cache when you do a // This skip ensures that if a stale object is present in the cache when you do a
// call it isn't immediately returned, but we wait until the remote data for the new request // call it isn't immediately returned, but we wait until the remote data for the new request
// is created. // is created.
skipWhile((rd: RemoteData<CacheableObject>) => rd.isStale), skipWhile((rd: RemoteData<CacheableObject>) => rd.isLoading || rd.isStale),
getFirstCompletedRemoteData(), take(1),
map((response: RemoteData<CacheableObject>) => { map((response: RemoteData<CacheableObject>) => {
if (hasValue(response.payload)) { if (hasValue(response.payload)) {
return response.payload._links; return response.payload._links;