Skip to content

Commit

Permalink
feat(ui-plugin) - Allow custom userContext states to be added (#12057)
Browse files Browse the repository at this point in the history
  • Loading branch information
mkamalas authored Jan 17, 2025
1 parent 3084147 commit 4a1fff5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
7 changes: 7 additions & 0 deletions datahub-web-react/src/app/context/CustomUserContext.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/**
* Custom User Context State - This is a custom user context state and can be overriden in specific fork of DataHub.
* The below type can be customized with specific object properties as well if needed.
*/
export type CustomUserContextState = Record<string, any>;

export const DEFAULT_CUSTOM_STATE: CustomUserContextState = {};
3 changes: 3 additions & 0 deletions datahub-web-react/src/app/context/userContext.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react';
import { CorpUser, PlatformPrivileges } from '../../types.generated';
import { CustomUserContextState, DEFAULT_CUSTOM_STATE } from './CustomUserContext';

/**
* Local State is persisted to local storage.
Expand All @@ -22,6 +23,7 @@ export type State = {
loadedPersonalDefaultViewUrn: boolean;
hasSetDefaultView: boolean;
};
customState?: CustomUserContextState;
};

/**
Expand Down Expand Up @@ -51,6 +53,7 @@ export const DEFAULT_STATE: State = {
loadedPersonalDefaultViewUrn: false,
hasSetDefaultView: false,
},
customState: DEFAULT_CUSTOM_STATE,
};

export const DEFAULT_CONTEXT = {
Expand Down

0 comments on commit 4a1fff5

Please sign in to comment.