mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
remove useLayoutEffect
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import React, { Fragment, useCallback, useEffect, useLayoutEffect, useMemo, useState, useRef } from 'react';
|
import React, { Fragment, useCallback, useEffect, useMemo, useState, useRef } from 'react';
|
||||||
import { confirmAlert } from 'react-confirm-alert';
|
import { confirmAlert } from 'react-confirm-alert';
|
||||||
import { createPortal } from 'react-dom';
|
import { createPortal } from 'react-dom';
|
||||||
import { Helmet } from 'react-helmet-async';
|
import { Helmet } from 'react-helmet-async';
|
||||||
@@ -163,6 +163,14 @@ const All = () => {
|
|||||||
}, [openMenuCid, handleOutsideClick]);
|
}, [openMenuCid, handleOutsideClick]);
|
||||||
|
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (postOnHoverRef.current) {
|
||||||
|
const rect = postOnHoverRef.current.getBoundingClientRect();
|
||||||
|
setPostOnHoverHeight(rect.height);
|
||||||
|
}
|
||||||
|
}, [outOfViewCid]);
|
||||||
|
|
||||||
|
|
||||||
const errorString = useMemo(() => {
|
const errorString = useMemo(() => {
|
||||||
for (const subplebbit of subplebbits) {
|
for (const subplebbit of subplebbits) {
|
||||||
if (subplebbit?.updatingState !== 'failed') {
|
if (subplebbit?.updatingState !== 'failed') {
|
||||||
@@ -457,14 +465,6 @@ const All = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
useLayoutEffect(() => {
|
|
||||||
if (postOnHoverRef.current) {
|
|
||||||
const rect = postOnHoverRef.current.getBoundingClientRect();
|
|
||||||
setPostOnHoverHeight(rect.height);
|
|
||||||
}
|
|
||||||
}, [outOfViewCid]);
|
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Helmet>
|
<Helmet>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import React, { Fragment, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
import React, { Fragment, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||||
import { createPortal } from 'react-dom';
|
import { createPortal } from 'react-dom';
|
||||||
import { Helmet } from 'react-helmet-async';
|
import { Helmet } from 'react-helmet-async';
|
||||||
import { Link, useNavigate, useParams } from 'react-router-dom';
|
import { Link, useNavigate, useParams } from 'react-router-dom';
|
||||||
@@ -171,6 +171,13 @@ const Board = () => {
|
|||||||
}, [openMenuCid, handleOutsideClick]);
|
}, [openMenuCid, handleOutsideClick]);
|
||||||
|
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (postOnHoverRef.current) {
|
||||||
|
const rect = postOnHoverRef.current.getBoundingClientRect();
|
||||||
|
setPostOnHoverHeight(rect.height);
|
||||||
|
}
|
||||||
|
}, [outOfViewCid]);
|
||||||
|
|
||||||
|
|
||||||
const errorString = useMemo(() => {
|
const errorString = useMemo(() => {
|
||||||
if (subplebbit?.state === 'failed') {
|
if (subplebbit?.state === 'failed') {
|
||||||
@@ -618,13 +625,6 @@ const Board = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
useLayoutEffect(() => {
|
|
||||||
if (postOnHoverRef.current) {
|
|
||||||
const rect = postOnHoverRef.current.getBoundingClientRect();
|
|
||||||
setPostOnHoverHeight(rect.height);
|
|
||||||
}
|
|
||||||
}, [outOfViewCid]);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import React, { Fragment, useCallback, useEffect, useLayoutEffect, useMemo, useState, useRef } from 'react';
|
import React, { Fragment, useCallback, useEffect, useMemo, useState, useRef } from 'react';
|
||||||
import { confirmAlert } from 'react-confirm-alert';
|
import { confirmAlert } from 'react-confirm-alert';
|
||||||
import { createPortal } from 'react-dom';
|
import { createPortal } from 'react-dom';
|
||||||
import { Helmet } from 'react-helmet-async';
|
import { Helmet } from 'react-helmet-async';
|
||||||
@@ -162,6 +162,14 @@ const Subscriptions = () => {
|
|||||||
}, [openMenuCid, handleOutsideClick]);
|
}, [openMenuCid, handleOutsideClick]);
|
||||||
|
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (postOnHoverRef.current) {
|
||||||
|
const rect = postOnHoverRef.current.getBoundingClientRect();
|
||||||
|
setPostOnHoverHeight(rect.height);
|
||||||
|
}
|
||||||
|
}, [outOfViewCid]);
|
||||||
|
|
||||||
|
|
||||||
const errorString = useMemo(() => {
|
const errorString = useMemo(() => {
|
||||||
for (const subplebbit of subplebbits) {
|
for (const subplebbit of subplebbits) {
|
||||||
if (subplebbit?.updatingState !== 'failed') {
|
if (subplebbit?.updatingState !== 'failed') {
|
||||||
@@ -459,14 +467,6 @@ const Subscriptions = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
useLayoutEffect(() => {
|
|
||||||
if (postOnHoverRef.current) {
|
|
||||||
const rect = postOnHoverRef.current.getBoundingClientRect();
|
|
||||||
setPostOnHoverHeight(rect.height);
|
|
||||||
}
|
|
||||||
}, [outOfViewCid]);
|
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Helmet>
|
<Helmet>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import React, { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||||
import { createPortal } from 'react-dom';
|
import { createPortal } from 'react-dom';
|
||||||
import { Helmet } from 'react-helmet-async';
|
import { Helmet } from 'react-helmet-async';
|
||||||
import { Link, useNavigate, useParams } from 'react-router-dom';
|
import { Link, useNavigate, useParams } from 'react-router-dom';
|
||||||
@@ -162,6 +162,14 @@ const Thread = () => {
|
|||||||
}, [openMenuCid, handleOutsideClick]);
|
}, [openMenuCid, handleOutsideClick]);
|
||||||
|
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (postOnHoverRef.current) {
|
||||||
|
const rect = postOnHoverRef.current.getBoundingClientRect();
|
||||||
|
setPostOnHoverHeight(rect.height);
|
||||||
|
}
|
||||||
|
}, [outOfViewCid]);
|
||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
window.scrollTo(0, 0);
|
window.scrollTo(0, 0);
|
||||||
}, []);
|
}, []);
|
||||||
@@ -549,14 +557,6 @@ const Thread = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
useLayoutEffect(() => {
|
|
||||||
if (postOnHoverRef.current) {
|
|
||||||
const rect = postOnHoverRef.current.getBoundingClientRect();
|
|
||||||
setPostOnHoverHeight(rect.height);
|
|
||||||
}
|
|
||||||
}, [outOfViewCid]);
|
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Helmet>
|
<Helmet>
|
||||||
|
|||||||
Reference in New Issue
Block a user