mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-29 06:15:29 -04:00
Correct use selector (#515)
This commit is contained in:
parent
971421925a
commit
a41d3d1515
20 changed files with 74 additions and 205 deletions
|
@ -1,3 +1,5 @@
|
|||
|
||||
import equal from 'fast-deep-equal'
|
||||
import React from 'react'
|
||||
import { useSelector } from 'react-redux'
|
||||
import { ApplicationState } from '../../../redux'
|
||||
|
@ -9,7 +11,7 @@ export interface BrandingProps {
|
|||
}
|
||||
|
||||
export const Branding: React.FC<BrandingProps> = ({ inline = false }) => {
|
||||
const branding = useSelector((state: ApplicationState) => state.config.branding)
|
||||
const branding = useSelector((state: ApplicationState) => state.config.branding, equal)
|
||||
const showBranding = !!branding.name || !!branding.logo
|
||||
|
||||
return (
|
||||
|
|
|
@ -7,11 +7,11 @@ export interface DocumentTitleProps {
|
|||
}
|
||||
|
||||
export const DocumentTitle: React.FC<DocumentTitleProps> = ({ title }) => {
|
||||
const branding = useSelector((state: ApplicationState) => state.config.branding)
|
||||
const brandingName = useSelector((state: ApplicationState) => state.config.branding.name)
|
||||
|
||||
useEffect(() => {
|
||||
document.title = `${title ? title + ' - ' : ''}CodiMD ${branding.name ? ` @ ${branding.name}` : ''}`
|
||||
}, [branding, title])
|
||||
document.title = `${title ? title + ' - ' : ''}CodiMD ${brandingName ? ` @ ${brandingName}` : ''}`
|
||||
}, [brandingName, title])
|
||||
|
||||
return null
|
||||
}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import equal from 'fast-deep-equal'
|
||||
import React from 'react'
|
||||
import { useSelector } from 'react-redux'
|
||||
import { Link } from 'react-router-dom'
|
||||
|
@ -8,7 +9,7 @@ import { ForkAwesomeIcon } from '../fork-awesome/fork-awesome-icon'
|
|||
import { ShowIf } from '../show-if/show-if'
|
||||
|
||||
export const MotdBanner: React.FC = () => {
|
||||
const bannerState = useSelector((state: ApplicationState) => state.banner)
|
||||
const bannerState = useSelector((state: ApplicationState) => state.banner, equal)
|
||||
|
||||
const dismissBanner = () => {
|
||||
setBanner({ ...bannerState, show: false })
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue