Skip to content

Commit

Permalink
[Fleet] Fix use read only context (#186861)
Browse files Browse the repository at this point in the history
  • Loading branch information
nchaulet authored Jun 26, 2024
1 parent cc80e95 commit fdef770
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export const EditPackagePolicyForm = memo<{
});

const canWriteIntegrationPolicies = useAuthz().integrations.writeIntegrationPolicies;
useSetIsReadOnly(canWriteIntegrationPolicies);
useSetIsReadOnly(!canWriteIntegrationPolicies);
const newSecrets = useMemo(() => {
if (!packageInfo) {
return [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export function useIsReadOnly() {
export function useSetIsReadOnly(isReadOnly: boolean) {
const context = useContext(ReadOnlyContext);
useEffect(() => {
context.setIsReadOnly(true);
context.setIsReadOnly(isReadOnly);
return () => context.setIsReadOnly(false);
}, [context]);
}, [context, isReadOnly]);
}

0 comments on commit fdef770

Please sign in to comment.