Catch error in RuleLink
parent
b85746de52
commit
babf0fb0f6
|
@ -16,6 +16,15 @@ export default function RuleLink(
|
|||
const sitePaths = useContext(SitePathsContext)
|
||||
const engine = useContext(EngineContext)
|
||||
|
||||
try {
|
||||
engine.getRule(props.dottedName)
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(error)
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
return (
|
||||
<EngineRuleLink
|
||||
{...props}
|
||||
|
|
|
@ -10,7 +10,7 @@ import { DottedName } from 'modele-social'
|
|||
import RuleLink from '../../RuleLink'
|
||||
import { Highlight } from '../Hightlight'
|
||||
|
||||
type Hit = AlgoliaHit<{ objectID: DottedName; namespace?: string }>
|
||||
type THit = AlgoliaHit<{ objectID: DottedName; namespace?: string }>
|
||||
|
||||
const StyledRuleLink = styled(RuleLink)`
|
||||
${SmallBody}, ${Body} {
|
||||
|
@ -42,7 +42,7 @@ const HitContainer = styled.li`
|
|||
}
|
||||
`
|
||||
|
||||
const Hit = (hit: Hit) => {
|
||||
const Hit = (hit: THit) => {
|
||||
return (
|
||||
<HitContainer>
|
||||
<StyledRuleLink dottedName={hit.objectID}>
|
||||
|
@ -89,7 +89,14 @@ const InfiniteHits = styled.div`
|
|||
}
|
||||
`
|
||||
|
||||
const Hits = connectInfiniteHits(({ hits, hasMore, refineNext }) => {
|
||||
interface IHits {
|
||||
hits: THit[]
|
||||
hasMore: boolean
|
||||
hasPrevious: boolean
|
||||
refineNext: () => void
|
||||
}
|
||||
|
||||
const Hits = connectInfiniteHits(({ hits, hasMore, refineNext }: IHits) => {
|
||||
const { t } = useTranslation()
|
||||
|
||||
return (
|
||||
|
|
|
@ -95,7 +95,7 @@ export function SimpleField({
|
|||
|
||||
const labelId = useSSRSafeId()
|
||||
const targetUnit = useSelector(targetUnitSelector)
|
||||
console.log(dottedName, evaluation)
|
||||
|
||||
if (evaluation.nodeValue === null) {
|
||||
return null
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue