File tree Expand file tree Collapse file tree
workspace/[workspaceId]/components/resource Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -13,6 +13,13 @@ import { getUserEntityPermissions } from '@/lib/workspaces/permissions/utils'
1313
1414const logger = createLogger ( 'FoldersAPI' )
1515
16+ function folderMutationStatus ( errorCode : string | undefined ) : number {
17+ if ( errorCode === 'validation' ) return 400
18+ if ( errorCode === 'conflict' ) return 409
19+ if ( errorCode === 'not_found' ) return 404
20+ return 500
21+ }
22+
1623// GET - Fetch folders for a workspace
1724export const GET = withRouteHandler ( async ( request : NextRequest ) => {
1825 try {
@@ -97,7 +104,10 @@ export const POST = withRouteHandler(async (request: NextRequest) => {
97104 } )
98105
99106 if ( ! result . success || ! result . folder ) {
100- return NextResponse . json ( { error : result . error } , { status : 500 } )
107+ return NextResponse . json (
108+ { error : result . error } ,
109+ { status : folderMutationStatus ( result . errorCode ) }
110+ )
101111 }
102112
103113 const newFolder = result . folder
Original file line number Diff line number Diff line change @@ -498,14 +498,14 @@ const DataRow = memo(function DataRow({
498498
499499 const handleClick = useCallback (
500500 ( e : React . MouseEvent < HTMLTableRowElement > ) => {
501- if ( e . shiftKey && selectable && ! selectable . disabled ) {
501+ if ( selectable && ! selectable . disabled && ( e . shiftKey || ! onRowClick ) ) {
502502 e . preventDefault ( )
503- selectable . onSelectRow ( row . id , true , true )
503+ selectable . onSelectRow ( row . id , ! isSelected , e . shiftKey )
504504 return
505505 }
506506 onRowClick ?.( row . id )
507507 } ,
508- [ onRowClick , row . id , selectable ]
508+ [ isSelected , onRowClick , row . id , selectable ]
509509 )
510510
511511 const handleMouseEnter = useCallback ( ( ) => {
You can’t perform that action at this time.
0 commit comments