Skip to content

Commit

Permalink
improve
Browse files Browse the repository at this point in the history
  • Loading branch information
Dosant committed Jan 7, 2020
1 parent 0ab4686 commit fe813c3
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
1 change: 0 additions & 1 deletion src/plugins/kibana_utils/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ export {
syncStates,
createKbnUrlSyncStrategy,
createSessionStorageSyncStrategy,
ISyncStrategy,
IStateSyncConfig,
ISyncStateRef,
IKbnUrlSyncStrategy,
Expand Down
1 change: 0 additions & 1 deletion src/plugins/kibana_utils/public/state_sync/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
export {
createKbnUrlSyncStrategy,
createSessionStorageSyncStrategy,
ISyncStrategy,
IKbnUrlSyncStrategy,
ISessionStorageSyncStrategy,
} from './state_sync_strategies';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export const createKbnUrlSyncStrategy = (
state: State,
{ replace = false }: { replace: boolean } = { replace: false }
) => {
// syncState() utils doesn't wait for this promise
return url.updateAsync(
currentUrl => setStateToKbnUrl(syncKey, state, { useHash }, currentUrl),
replace
Expand Down
8 changes: 4 additions & 4 deletions src/plugins/kibana_utils/public/state_sync/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ import { BaseStateContainer } from '../state_containers/types';
import { ISyncStrategy } from './state_sync_strategies';

export interface INullableBaseStateContainer<State> extends BaseStateContainer<State> {
// State sync state container have to handle setting "null"
// set() implementation could handle null and fallback to some state defaults
// this is required to handle edge case, when state in storage became empty and syncing is in progress.
// state container will be notified about about storage becoming empty
// State container for stateSync() have to accept "null"
// for example, set() implementation could handle null and fallback to some default state
// this is required to handle edge case, when state in storage becomes empty and syncing is in progress.
// state container will be notified about about storage becoming empty with null passed in
set: (state: State | null) => void;
}

Expand Down

0 comments on commit fe813c3

Please sign in to comment.