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 { isNotEmpty } from './shared/empty.util';
|
||||||
import { StoreActionTypes } from './store.actions';
|
import { StoreActionTypes } from './store.actions';
|
||||||
|
|
||||||
// crude temporary ngrx debugger for use until
|
// fallback ngrx debugger
|
||||||
// https://github.com/ngrx/platform/issues/97 is fixed
|
|
||||||
let actionCounter = 0;
|
let actionCounter = 0;
|
||||||
|
|
||||||
export function debugMetaReducer(reducer) {
|
export function debugMetaReducer(reducer) {
|
||||||
@@ -26,12 +25,14 @@ export function universalMetaReducer(reducer) {
|
|||||||
state = Object.assign({}, state, action.payload);
|
state = Object.assign({}, state, action.payload);
|
||||||
break;
|
break;
|
||||||
case StoreActionTypes.REPLAY:
|
case StoreActionTypes.REPLAY:
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
|
break;
|
||||||
return reducer(state, action);
|
|
||||||
}
|
}
|
||||||
|
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
|
IdlePreloadModule.forRoot(), // forRoot ensures the providers are only created once
|
||||||
RouterModule.forRoot([], { useHash: false, preloadingStrategy: IdlePreload }),
|
RouterModule.forRoot([], { useHash: false, preloadingStrategy: IdlePreload }),
|
||||||
StoreRouterConnectingModule,
|
|
||||||
TranslateModule.forRoot({
|
TranslateModule.forRoot({
|
||||||
loader: {
|
loader: {
|
||||||
provide: TranslateLoader,
|
provide: TranslateLoader,
|
||||||
@@ -60,6 +59,7 @@ export function HttpLoaderFactory(http: Http) {
|
|||||||
BrowserTransferStateModule,
|
BrowserTransferStateModule,
|
||||||
BrowserTransferStoreModule,
|
BrowserTransferStoreModule,
|
||||||
EffectsModule.forRoot([BrowserTransferStoreEffects]),
|
EffectsModule.forRoot([BrowserTransferStoreEffects]),
|
||||||
|
StoreRouterConnectingModule,
|
||||||
BrowserAnimationsModule,
|
BrowserAnimationsModule,
|
||||||
AppModule
|
AppModule
|
||||||
],
|
],
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
import { Injectable, Inject } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Actions, Effect } from '@ngrx/effects';
|
import { Actions, Effect } from '@ngrx/effects';
|
||||||
|
|
||||||
import { ObjectCacheActionTypes } from '../cache/object-cache.actions';
|
|
||||||
import { ResetResponseCacheTimestampsAction } from '../cache/response-cache.actions';
|
import { ResetResponseCacheTimestampsAction } from '../cache/response-cache.actions';
|
||||||
|
import { StoreActionTypes } from '../../store.actions';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class RequestCacheEffects {
|
export class RequestCacheEffects {
|
||||||
@@ -14,17 +14,9 @@ export class RequestCacheEffects {
|
|||||||
*
|
*
|
||||||
* This assumes that the server cached everything a negligible
|
* This assumes that the server cached everything a negligible
|
||||||
* time ago, and will likely need to be revisited later
|
* 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$
|
@Effect() fixTimestampsOnRehydrate = this.actions$
|
||||||
.ofType(ObjectCacheActionTypes.RESET_TIMESTAMPS)
|
.ofType(StoreActionTypes.REHYDRATE)
|
||||||
.map(() => new ResetResponseCacheTimestampsAction(new Date().getTime()));
|
.map(() => new ResetResponseCacheTimestampsAction(new Date().getTime()));
|
||||||
|
|
||||||
constructor(private actions$: Actions, ) { }
|
constructor(private actions$: Actions, ) { }
|
||||||
|
@@ -8,6 +8,7 @@ import { StoreAction, StoreActionTypes } from '../../app/store.actions';
|
|||||||
import { AppState } from '../../app/app.reducer';
|
import { AppState } from '../../app/app.reducer';
|
||||||
|
|
||||||
import { GLOBAL_CONFIG, GlobalConfig } from '../../config';
|
import { GLOBAL_CONFIG, GlobalConfig } from '../../config';
|
||||||
|
import { RouterNavigationAction } from '@ngrx/router-store';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class BrowserTransferState extends TransferState {
|
export class BrowserTransferState extends TransferState {
|
||||||
|
Reference in New Issue
Block a user