mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
perf(app): optimize loading times by using stored values of subplebbits and comments instead of fetching them multiple times
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import { useState } from 'react';
|
||||
import { Link, useLocation } from 'react-router-dom';
|
||||
import useSubplebbitsStore from '@plebbit/plebbit-react-hooks/dist/stores/subplebbits';
|
||||
import { HomeLogo } from '../home';
|
||||
import styles from './not-found.module.css';
|
||||
import { useSubplebbit } from '@plebbit/plebbit-react-hooks';
|
||||
|
||||
const totalNotFoundImages = 2;
|
||||
|
||||
@@ -18,7 +18,7 @@ const NotFoundImage = () => {
|
||||
const NotFound = () => {
|
||||
const location = useLocation();
|
||||
const subplebbitAddress = location.pathname.startsWith('/p/') ? location.pathname.split('/')[2] : '';
|
||||
const subplebbit = useSubplebbit({ subplebbitAddress });
|
||||
const subplebbit = useSubplebbitsStore((state) => state.subplebbits[subplebbitAddress]);
|
||||
const { address, shortAddress } = subplebbit || {};
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user