mirror of
https://github.com/enso-org/enso.git
synced 2024-12-29 21:13:10 +03:00
Follow-up for Remote backend fixes PR (#11080)
This PR is a follow-up for https://github.com/enso-org/enso/pull/11067 that addresses the issues raised in the PR
This commit is contained in:
parent
cad50a5b63
commit
bea9d3670a
@ -92,7 +92,7 @@ export default function JSONSchemaInput(props: JSONSchemaInputProps) {
|
|||||||
value={typeof value === 'string' ? value : ''}
|
value={typeof value === 'string' ? value : ''}
|
||||||
size={1}
|
size={1}
|
||||||
className={twMerge(
|
className={twMerge(
|
||||||
'focus-child text w-60 w-full grow rounded-input border-0.5 bg-transparent px-input-x read-only:read-only',
|
'focus-child text w-full grow rounded-input border-0.5 bg-transparent px-input-x read-only:read-only',
|
||||||
getValidator(path)(value) ? 'border-primary/20' : 'border-red-700/60',
|
getValidator(path)(value) ? 'border-primary/20' : 'border-red-700/60',
|
||||||
)}
|
)}
|
||||||
placeholder={getText('enterText')}
|
placeholder={getText('enterText')}
|
||||||
|
@ -70,11 +70,11 @@ export default function AssetsTableContextMenu(props: AssetsTableContextMenuProp
|
|||||||
// up to date.
|
// up to date.
|
||||||
const ownsAllSelectedAssets =
|
const ownsAllSelectedAssets =
|
||||||
!isCloud ||
|
!isCloud ||
|
||||||
[...selectedKeys].every((key) => {
|
Array.from(selectedKeys).every(
|
||||||
const userPermissions = nodeMapRef.current.get(key)?.item.permissions
|
(key) =>
|
||||||
const selfPermission = permissions.tryFindSelfPermission(user, userPermissions ?? null)
|
permissions.tryFindSelfPermission(user, nodeMapRef.current.get(key)?.item.permissions)
|
||||||
return selfPermission?.permission === permissions.PermissionAction.own
|
?.permission === permissions.PermissionAction.own,
|
||||||
})
|
)
|
||||||
|
|
||||||
// This is not a React component even though it contains JSX.
|
// This is not a React component even though it contains JSX.
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
// eslint-disable-next-line no-restricted-syntax
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
/** @file The React provider for modals, along with hooks to use the provider via
|
/** @file The React provider for modals, along with hooks to use the provider via
|
||||||
* the shared React context. */
|
* the shared React context. */
|
||||||
import { useEventCallback } from '#/hooks/eventCallbackHooks'
|
import { useEventCallback } from '#/hooks/eventCallbackHooks'
|
||||||
|
import { useSyncRef } from '#/hooks/syncRefHooks'
|
||||||
import * as React from 'react'
|
import * as React from 'react'
|
||||||
|
|
||||||
// =====================
|
// =====================
|
||||||
@ -39,13 +40,9 @@ export interface ModalProviderProps extends Readonly<React.PropsWithChildren> {}
|
|||||||
export default function ModalProvider(props: ModalProviderProps) {
|
export default function ModalProvider(props: ModalProviderProps) {
|
||||||
const { children } = props
|
const { children } = props
|
||||||
const [modal, setModal] = React.useState<Modal | null>(null)
|
const [modal, setModal] = React.useState<Modal | null>(null)
|
||||||
// we use key to tell react to invaldidate the modal when we change it.
|
// We use keys to tell react to invalidate the DialogTrigger when we change the modal.
|
||||||
const [key, setKey] = React.useState(0)
|
const [key, setKey] = React.useState(0)
|
||||||
const modalRef = React.useRef(modal)
|
const modalRef = useSyncRef(modal)
|
||||||
|
|
||||||
React.useEffect(() => {
|
|
||||||
modalRef.current = modal
|
|
||||||
}, [modal])
|
|
||||||
|
|
||||||
const setModalStableCallback = useEventCallback(
|
const setModalStableCallback = useEventCallback(
|
||||||
(nextModal: React.SetStateAction<React.JSX.Element | null>) => {
|
(nextModal: React.SetStateAction<React.JSX.Element | null>) => {
|
||||||
@ -64,7 +61,7 @@ export default function ModalProvider(props: ModalProviderProps) {
|
|||||||
{children}
|
{children}
|
||||||
</ModalStaticProvider>
|
</ModalStaticProvider>
|
||||||
),
|
),
|
||||||
[children, setModalStableCallback],
|
[children, modalRef, setModalStableCallback],
|
||||||
)
|
)
|
||||||
return <ModalContext.Provider value={{ modal, key }}>{setModalProvider}</ModalContext.Provider>
|
return <ModalContext.Provider value={{ modal, key }}>{setModalProvider}</ModalContext.Provider>
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,7 @@ export function tryCreateOwnerPermission(
|
|||||||
/** Try to find a permission belonging to the user. */
|
/** Try to find a permission belonging to the user. */
|
||||||
export function tryFindSelfPermission(
|
export function tryFindSelfPermission(
|
||||||
self: User,
|
self: User,
|
||||||
otherPermissions: readonly AssetPermission[] | null,
|
otherPermissions: readonly AssetPermission[] | null | undefined,
|
||||||
) {
|
) {
|
||||||
let selfPermission: AssetPermission | null = null
|
let selfPermission: AssetPermission | null = null
|
||||||
for (const permission of otherPermissions ?? []) {
|
for (const permission of otherPermissions ?? []) {
|
||||||
|
@ -94,11 +94,6 @@ const RESTRICTED_SYNTAXES = [
|
|||||||
selector: 'TSTypeAliasDeclaration > :matches(TSLiteralType)',
|
selector: 'TSTypeAliasDeclaration > :matches(TSLiteralType)',
|
||||||
message: 'No aliases to literal types',
|
message: 'No aliases to literal types',
|
||||||
},
|
},
|
||||||
{
|
|
||||||
selector:
|
|
||||||
':not(:matches(FunctionDeclaration, FunctionExpression, ArrowFunctionExpression, SwitchStatement, SwitchCase, IfStatement:has(.consequent > :matches(ReturnStatement, ThrowStatement)):has(.alternate :matches(ReturnStatement, ThrowStatement)), Program > TryStatement, Program > TryStatement > .handler, TryStatement:has(.block > :matches(ReturnStatement, ThrowStatement)):has(:matches([handler=null], .handler :matches(ReturnStatement, ThrowStatement))), TryStatement:has(.block > :matches(ReturnStatement, ThrowStatement)):has(:matches([handler=null], .handler :matches(ReturnStatement, ThrowStatement))) > .handler)) > * > :matches(ReturnStatement, ThrowStatement)',
|
|
||||||
message: 'No early returns',
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
selector:
|
selector:
|
||||||
'TSTypeAliasDeclaration > :matches(TSBooleanKeyword, TSBigintKeyword, TSNullKeyword, TSNumberKeyword, TSObjectKeyword, TSStringKeyword, TSSymbolKeyword, TSUndefinedKeyword, TSUnknownKeyword, TSVoidKeyword)',
|
'TSTypeAliasDeclaration > :matches(TSBooleanKeyword, TSBigintKeyword, TSNullKeyword, TSNumberKeyword, TSObjectKeyword, TSStringKeyword, TSSymbolKeyword, TSUndefinedKeyword, TSUnknownKeyword, TSVoidKeyword)',
|
||||||
|
Loading…
Reference in New Issue
Block a user