Skip to content

Commit

Permalink
perf(react-repeater): simplify sortableBy type
Browse files Browse the repository at this point in the history
  • Loading branch information
matej21 committed Jul 8, 2024
1 parent ee7a3a5 commit d6250cd
Showing 1 changed file with 5 additions and 16 deletions.
21 changes: 5 additions & 16 deletions packages/react-repeater/src/components/Repeater.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,21 @@ import React, { useEffect, useMemo } from 'react'
import { verifySortableProp } from '../internal/verifySortableProp'
import { useCreateRepeaterMethods } from '../internal/useCreateRepeaterMethods'
import { RepeaterEntityListAccessorContext, RepeaterMethodsContext, RepeaterSortedEntitiesContext } from '../contexts'
import {
Component,
EntityListSubTree,
HasMany,
repairEntitiesOrder,
sortEntities,
SugaredField,
SugaredFieldProps,
useEntityList,
useEntityListSubTree,
useEnvironment,
} from '@contember/react-binding'
import { EntityListAccessor, QueryLanguage, SugaredQualifiedEntityList, SugaredRelativeEntityList } from '@contember/binding'
import { Component, EntityListSubTree, HasMany, repairEntitiesOrder, sortEntities, SugaredField, useEntityList, useEntityListSubTree, useEnvironment } from '@contember/react-binding'
import { EntityListAccessor, QueryLanguage, SugaredQualifiedEntityList, SugaredRelativeEntityList, SugaredRelativeSingleField } from '@contember/binding'

export type RepeaterRelativeProps =
& SugaredRelativeEntityList
& {
children?: React.ReactNode
sortableBy?: SugaredFieldProps['field']
sortableBy?: SugaredRelativeSingleField['field']
}

export type RepeaterQualifiedProps =
& SugaredQualifiedEntityList
& {
children?: React.ReactNode
sortableBy?: SugaredFieldProps['field']
sortableBy?: SugaredRelativeSingleField['field']
}

export type RepeaterProps =
Expand Down Expand Up @@ -90,7 +79,7 @@ const RepeaterQualified = Component(
interface RepeaterInnerProps {
accessor: EntityListAccessor
children: React.ReactNode
sortableBy?: SugaredFieldProps['field']
sortableBy?: SugaredRelativeSingleField['field']
}

const RepeaterInner = ({ sortableBy, accessor, children }: RepeaterInnerProps) => {
Expand Down

0 comments on commit d6250cd

Please sign in to comment.