mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-14 15:14:56 -04:00
Add application state hook (#1308)
* Add application state hook Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de> * Add docs Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
4720f2d36b
commit
829cc2fe48
47 changed files with 149 additions and 195 deletions
|
@ -6,18 +6,18 @@
|
|||
|
||||
import equal from 'fast-deep-equal'
|
||||
import { useEffect, useRef } from 'react'
|
||||
import { useSelector } from 'react-redux'
|
||||
import { ApplicationState, store } from '../../../redux'
|
||||
import { store } from '../../../redux'
|
||||
import { useParams } from 'react-router-dom'
|
||||
import { EditorPagePathParams } from '../editor-page'
|
||||
import { HistoryEntry, HistoryEntryOrigin } from '../../../redux/history/types'
|
||||
import { updateLocalHistoryEntry } from '../../../redux/history/methods'
|
||||
import { useApplicationState } from '../../../hooks/common/use-application-state'
|
||||
|
||||
export const useUpdateLocalHistoryEntry = (updateReady: boolean): void => {
|
||||
const { id } = useParams<EditorPagePathParams>()
|
||||
const userExists = useSelector((state: ApplicationState) => !!state.user)
|
||||
const currentNoteTitle = useSelector((state: ApplicationState) => state.noteDetails.noteTitle)
|
||||
const currentNoteTags = useSelector((state: ApplicationState) => state.noteDetails.frontmatter.tags)
|
||||
const userExists = useApplicationState((state) => !!state.user)
|
||||
const currentNoteTitle = useApplicationState((state) => state.noteDetails.noteTitle)
|
||||
const currentNoteTags = useApplicationState((state) => state.noteDetails.frontmatter.tags)
|
||||
|
||||
const lastNoteTitle = useRef('')
|
||||
const lastNoteTags = useRef<string[]>([])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue