Skip to content

Commit

Permalink
Add some todos
Browse files Browse the repository at this point in the history
  • Loading branch information
estermv committed Aug 24, 2021
1 parent 91cbaed commit b9f12f7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ interface State {
export const GlobalStateContext = createContext({} as State);

export const GlobalStateProvider = ({ query, toasts, children }: GlobalStateProviderProps) => {
const fakeRootScope: Partial<ng.IRootScopeService> = {
// TODO: remove fakeAngularRootScope and fakeAngularLocation when angular is removed
const fakeAngularRootScope: Partial<ng.IRootScopeService> = {
$on: (
name: string,
listener: (event: ng.IAngularEvent, ...args: any[]) => any
Expand All @@ -39,7 +40,13 @@ export const GlobalStateProvider = ({ query, toasts, children }: GlobalStateProv
};

const localState: { [key: string]: unknown } = {};
const state = new GlobalState(query, toasts, fakeRootScope, fakeAngularLocation, localState);
const state = new GlobalState(
query,
toasts,
fakeAngularRootScope,
fakeAngularLocation,
localState
);

const initialState: any = state.getState();
for (const key in initialState) {
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/monitoring/public/url_state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export interface MonitoringAppStateTransitions {
const GLOBAL_STATE_KEY = '_g';
const objectEquals = (objA: any, objB: any) => JSON.stringify(objA) === JSON.stringify(objB);

// TODO: clean all angular references after angular is removed
export class GlobalState {
private readonly stateSyncRef: ISyncStateRef;
private readonly stateContainer: StateContainer<
Expand Down

0 comments on commit b9f12f7

Please sign in to comment.