Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default InviewContext to true so wheneven CommentComponent is used … #391

Merged
merged 1 commit into from
Aug 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions frontend/src/Components/UserProfileComments.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {useCache} from '../API/use/useCache';
import {CommentInfo} from '../Types/PostInfo';
import CommentComponent from './CommentComponent';
import {useDebouncedCallback} from 'use-debounce';
import {InviewContext} from '../Pages/PostPage';

type UserProfileCommentsProps = {
username: string;
Expand Down Expand Up @@ -99,9 +98,7 @@ export default function UserProfileComments(props: UserProfileCommentsProps) {
{loading ? <div className={styles.loading}></div> :
<>
{error && <div className={styles.error}>{styles.error}</div> }
<InviewContext.Provider value={true}>

{comments ?
{comments ?
comments.map(comment =>
<CommentComponent idx={getParentComment(comment.parentComment) ? 1 : 0}
parent={getParentComment(comment.parentComment)} key={comment.id}
Expand All @@ -113,7 +110,6 @@ export default function UserProfileComments(props: UserProfileCommentsProps) {
: <div className={styles.loading}>Загрузка...</div>
)
}
</InviewContext.Provider>
<div className={styles.paginatorContainer}>
<Paginator page={page} pages={pages} base={`/u/${props.username}/comments`} queryStringParams={params} />
</div>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/Pages/PostPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {InView} from 'react-intersection-observer';

const THREAD_GROUP_SIZE = 10;

export const InviewContext = createContext<boolean>(false);
export const InviewContext = createContext<boolean>(true);

export default function PostPage() {
const params = useParams<{postId: string}>();
Expand Down
3 changes: 0 additions & 3 deletions frontend/src/Pages/SearchPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {UserGender} from '../Types/UserInfo';
import classNames from 'classnames';
import {useCache} from '../API/use/useCache';
import {LARGE_AUTO_CUT} from '../Components/ContentComponent';
import {InviewContext} from './PostPage';

type SearchForm = {
term: string;
Expand All @@ -27,7 +26,6 @@ function SearchResult(props: {
{!total.value ? 'Ничего не найдено' :
<>{total.value.toLocaleString()} найдено {total.value > 250 && <>(250 показано)</>}</>}
</div>
<InviewContext.Provider value={true}>

{results.map((resultItem: SearchResultEntity) => {
const author = {username: resultItem.author, id: 0, gender: UserGender.fluid};
Expand Down Expand Up @@ -64,7 +62,6 @@ function SearchResult(props: {
showSite={true} hideRating={true}/>;

})}
</InviewContext.Provider>
</>;
}

Expand Down
Loading