11import { Objects as ObjectsI , Object as ObjectI } from './rdf-json'
22import React , { useMemo } from 'react'
3- import { stringToHashNumber } from './hash'
43import { useViewerContext } from './viewer-context'
54import Qualifiers from './Qualifiers'
65import SimpleObject from './SimpleObject'
76import { usePredicateContext } from './predicate-context'
87import SeeMoreButton from './SeeMoreButton'
9- import { isStandardReifiedStatement } from './common'
8+ import { compareObjects , isStandardReifiedStatement } from './common'
109
1110interface Props {
1211 objects : ObjectsI
@@ -15,14 +14,12 @@ interface Props {
1514function Objects ( props : Props ) : JSX . Element {
1615 const { objects } = props
1716
18- const { data, labelIRIs } = useViewerContext ( )
17+ const viewerCtx = useViewerContext ( )
18+ const { data, labelIRIs } = viewerCtx
1919 if ( data === undefined ) throw new Error ( 'Objects: data is undefined' )
2020 const { howManyVisibleObjects, setHowManyVisibleObjects } = usePredicateContext ( )
2121
22- // Values sorted by type
23- const sortedObjects = useMemo ( ( ) => objects . sort ( ( a , b ) => (
24- stringToHashNumber ( a . type ) - stringToHashNumber ( b . type )
25- ) ) , [ objects ] )
22+ const sortedObjects = useMemo ( ( ) => objects . sort ( ( a , b ) => compareObjects ( viewerCtx , a , b ) ) , [ objects ] )
2623
2724 // Make groups of objects based on whether they are bnodes or not
2825 const groups = useMemo ( ( ) => {
0 commit comments