Skip to content

Commit 4c6dee9

Browse files
committed
fix(web): Use recomend ref naming for refs
warning A ref identifier must be named 'ref' or ending in 'Ref' @eslint-react/naming-convention-ref-name
1 parent fe9dfdd commit 4c6dee9

1 file changed

Lines changed: 15 additions & 15 deletions

File tree

web/src/pages/Docs.tsx

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ export default function Docs(): JSX.Element {
1919
const [projectLoading, setProjectLoading] = useState<boolean>(true)
2020
const [notFound, setNotFound] = useState<boolean>(false)
2121

22-
const page = useRef(params['*'] ?? '')
23-
const hash = useRef(location.hash)
22+
const pageRef = useRef(params['*'] ?? '')
23+
const hashRef = useRef(location.hash)
2424

2525
const [project, setProject] = useState<string>(params.project ?? '')
2626
const [version, setVersion] = useState<string>(params.version ?? 'latest')
@@ -39,8 +39,8 @@ export default function Docs(): JSX.Element {
3939
return ProjectRepository.getProjectDocsURL(
4040
project,
4141
displayVersion.name,
42-
page.current,
43-
hash.current
42+
pageRef.current,
43+
hashRef.current
4444
)
4545
}, [project, displayVersion, iframeUpdateTrigger])
4646

@@ -67,11 +67,11 @@ export default function Docs(): JSX.Element {
6767
}
6868

6969
const getShareUrl = (options: { useLatest: boolean, hideUi: boolean }): string => {
70-
return buildBrowserUrl(project, options.useLatest ? 'latest' : displayVersion?.name ?? 'latest', page.current, hash.current, options.hideUi)
70+
return buildBrowserUrl(project, options.useLatest ? 'latest' : displayVersion?.name ?? 'latest', pageRef.current, hashRef.current, options.hideUi)
7171
}
7272

7373
const updateUrl = (newProject: string, newVersion: string, hideUi: boolean): void => {
74-
window.history.pushState(null, '', buildBrowserUrl(newProject, newVersion, page.current, hash.current, hideUi))
74+
window.history.pushState(null, '', buildBrowserUrl(newProject, newVersion, pageRef.current, hashRef.current, hideUi))
7575
}
7676

7777
useEffect(() => {
@@ -114,19 +114,19 @@ export default function Docs(): JSX.Element {
114114
if (title != null && title !== document.title) {
115115
updateTitle(title)
116116
}
117-
if (urlPage === page.current) {
117+
if (urlPage === pageRef.current) {
118118
return
119119
}
120-
page.current = urlPage
121-
hash.current = urlHash
120+
pageRef.current = urlPage
121+
hashRef.current = urlHash
122122
updateUrl(project, version, hideUi)
123123
}
124124

125125
const iFrameHashChanged = (newHash: string): void => {
126-
if (newHash === hash.current) {
126+
if (newHash === hashRef.current) {
127127
return
128128
}
129-
hash.current = newHash
129+
hashRef.current = newHash
130130
updateUrl(project, version, hideUi)
131131
}
132132

@@ -155,12 +155,12 @@ export default function Docs(): JSX.Element {
155155
setVersion(urlVersion)
156156
setHideUi(urlHideUi)
157157

158-
if (urlPage !== page.current) {
159-
page.current = urlPage
158+
if (urlPage !== pageRef.current) {
159+
pageRef.current = urlPage
160160
setIframeUpdateTrigger((v) => v + 1)
161161
}
162-
if (urlHash !== hash.current) {
163-
hash.current = urlHash
162+
if (urlHash !== hashRef.current) {
163+
hashRef.current = urlHash
164164
setIframeUpdateTrigger((v) => v + 1)
165165
}
166166
}, [location])

0 commit comments

Comments
 (0)