mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-23 03:27:05 -04:00
fix(frontend): migrate type changes
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
2f5dadb981
commit
61362f9175
37 changed files with 80 additions and 79 deletions
|
@ -16,7 +16,6 @@ import { useMemo } from 'react'
|
|||
export const useSingleStringUrlParameter = <T>(parameter: string, fallback: T): string | T => {
|
||||
const router = useSearchParams()
|
||||
|
||||
return useMemo(() => {
|
||||
return router?.get(parameter) ?? fallback
|
||||
}, [fallback, parameter, router])
|
||||
const value = useMemo(() => router?.get(parameter) ?? null, [parameter, router])
|
||||
return value ?? fallback
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ export const useTrimmedNoteMarkdownContentWithoutFrontmatter = (): string[] => {
|
|||
|
||||
const trimmedLines = useMemo(() => {
|
||||
if (!markdownContent) {
|
||||
return undefined
|
||||
return null
|
||||
}
|
||||
if (markdownContent.content.length > maxLength) {
|
||||
return markdownContent.content.slice(0, maxLength).split('\n')
|
||||
|
@ -39,6 +39,6 @@ export const useTrimmedNoteMarkdownContentWithoutFrontmatter = (): string[] => {
|
|||
}, [markdownContent, maxLength])
|
||||
|
||||
return useMemo(() => {
|
||||
return trimmedLines === undefined || lineOffset === undefined ? [] : trimmedLines.slice(lineOffset)
|
||||
return trimmedLines === null || lineOffset === undefined ? [] : trimmedLines.slice(lineOffset)
|
||||
}, [lineOffset, trimmedLines])
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue