Skip to content

Commit

Permalink
Fixed validation message
Browse files Browse the repository at this point in the history
  • Loading branch information
rmathis committed Jun 14, 2022
1 parent df6ded6 commit 01d380b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
8 changes: 7 additions & 1 deletion ui/src/app/core/user/UserContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function UserProvider({ children }) {

const [user, setUser] = React.useState({});

const providerValue = React.useMemo(() => ({ user, loading }), [user, loading]);
const providerValue = React.useMemo(() => ({ user, loading, loadUser }), [user, loading, loadUser]);

return (
<Provider value={providerValue}>{children}</Provider>
Expand All @@ -43,6 +43,11 @@ function useCurrentUserLoading() {
return loading;
}

function useCurrentUserLoader() {
const { loadUser } = React.useContext(UserContext);
return loadUser;
}

function useIsAdmin() {
const user = useCurrentUser();
return user.role === 'ROLE_ADMIN';
Expand Down Expand Up @@ -100,6 +105,7 @@ export {
useIsAdminOrInGroup,
useCanEnable,
useCurrentUserLoading,
useCurrentUserLoader,
useUserGroupRegexValidator,
useUserGroup,
useUserGroupNames
Expand Down
9 changes: 8 additions & 1 deletion ui/src/app/metadata/wizard/MetadataSourceWizard.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,20 @@ import { useMetadataSources } from '../hooks/api';

import Translate from '../../i18n/components/translate';
import { checkChanges } from '../hooks/utility';
import { useUserGroup } from '../../core/user/UserContext';
import { useCurrentUserLoader, useUserGroup } from '../../core/user/UserContext';


export function MetadataSourceWizard ({ onShowNav, onSave, block, loading }) {

const group = useUserGroup();

const userLoader = useCurrentUserLoader();

/*eslint-disable react-hooks/exhaustive-deps*/
React.useEffect(() => {
userLoader();
}, []);

const { data } = useMetadataSources({
cachePolicy: 'no-cache'
}, []);
Expand Down

0 comments on commit 01d380b

Please sign in to comment.