mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-13 04:53:06 +00:00
fixed rehydrate issue
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
import { isNotEmpty } from './shared/empty.util';
|
||||
import { StoreActionTypes } from './store.actions';
|
||||
|
||||
// crude temporary ngrx debugger for use until
|
||||
// https://github.com/ngrx/platform/issues/97 is fixed
|
||||
// fallback ngrx debugger
|
||||
let actionCounter = 0;
|
||||
|
||||
export function debugMetaReducer(reducer) {
|
||||
@@ -26,12 +25,14 @@ export function universalMetaReducer(reducer) {
|
||||
state = Object.assign({}, state, action.payload);
|
||||
break;
|
||||
case StoreActionTypes.REPLAY:
|
||||
break;
|
||||
default:
|
||||
|
||||
return reducer(state, action);
|
||||
break;
|
||||
}
|
||||
return reducer(state, action);
|
||||
}
|
||||
}
|
||||
|
||||
export const appMetaReducers = [debugMetaReducer, universalMetaReducer];
|
||||
export const appMetaReducers = [
|
||||
// debugMetaReducer,
|
||||
universalMetaReducer,
|
||||
];
|
||||
|
@@ -46,7 +46,6 @@ export function HttpLoaderFactory(http: Http) {
|
||||
}),
|
||||
IdlePreloadModule.forRoot(), // forRoot ensures the providers are only created once
|
||||
RouterModule.forRoot([], { useHash: false, preloadingStrategy: IdlePreload }),
|
||||
StoreRouterConnectingModule,
|
||||
TranslateModule.forRoot({
|
||||
loader: {
|
||||
provide: TranslateLoader,
|
||||
@@ -60,6 +59,7 @@ export function HttpLoaderFactory(http: Http) {
|
||||
BrowserTransferStateModule,
|
||||
BrowserTransferStoreModule,
|
||||
EffectsModule.forRoot([BrowserTransferStoreEffects]),
|
||||
StoreRouterConnectingModule,
|
||||
BrowserAnimationsModule,
|
||||
AppModule
|
||||
],
|
||||
|
@@ -1,8 +1,8 @@
|
||||
import { Injectable, Inject } from '@angular/core';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Actions, Effect } from '@ngrx/effects';
|
||||
|
||||
import { ObjectCacheActionTypes } from '../cache/object-cache.actions';
|
||||
import { ResetResponseCacheTimestampsAction } from '../cache/response-cache.actions';
|
||||
import { StoreActionTypes } from '../../store.actions';
|
||||
|
||||
@Injectable()
|
||||
export class RequestCacheEffects {
|
||||
@@ -14,17 +14,9 @@ export class RequestCacheEffects {
|
||||
*
|
||||
* This assumes that the server cached everything a negligible
|
||||
* time ago, and will likely need to be revisited later
|
||||
*
|
||||
* This effect should listen for StoreActionTypes.REHYDRATE,
|
||||
* but can't because you can only have one effect listen to
|
||||
* an action atm. Github issue:
|
||||
* https://github.com/ngrx/effects/issues/87
|
||||
*
|
||||
* It's listening for ObjectCacheActionTypes.RESET_TIMESTAMPS
|
||||
* instead, until there's a solution.
|
||||
*/
|
||||
@Effect() fixTimestampsOnRehydrate = this.actions$
|
||||
.ofType(ObjectCacheActionTypes.RESET_TIMESTAMPS)
|
||||
.ofType(StoreActionTypes.REHYDRATE)
|
||||
.map(() => new ResetResponseCacheTimestampsAction(new Date().getTime()));
|
||||
|
||||
constructor(private actions$: Actions, ) { }
|
||||
|
@@ -8,6 +8,7 @@ import { StoreAction, StoreActionTypes } from '../../app/store.actions';
|
||||
import { AppState } from '../../app/app.reducer';
|
||||
|
||||
import { GLOBAL_CONFIG, GlobalConfig } from '../../config';
|
||||
import { RouterNavigationAction } from '@ngrx/router-store';
|
||||
|
||||
@Injectable()
|
||||
export class BrowserTransferState extends TransferState {
|
||||
|
Reference in New Issue
Block a user