mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
add useBufferedFeeds
This commit is contained in:
+14
-1
@@ -1,6 +1,7 @@
|
|||||||
import React, { useEffect } from 'react';
|
import React, { useEffect } from 'react';
|
||||||
import { Route, Routes, useLocation } from 'react-router-dom';
|
import { Route, Routes, useLocation } from 'react-router-dom';
|
||||||
import { Helmet } from 'react-helmet-async';
|
import { Helmet } from 'react-helmet-async';
|
||||||
|
import { useAccount, useBufferedFeeds } from '@plebbit/plebbit-react-hooks';
|
||||||
import styled, { createGlobalStyle } from 'styled-components';
|
import styled, { createGlobalStyle } from 'styled-components';
|
||||||
import { ToastContainer } from 'react-toastify';
|
import { ToastContainer } from 'react-toastify';
|
||||||
import 'react-tooltip/dist/react-tooltip.css';
|
import 'react-tooltip/dist/react-tooltip.css';
|
||||||
@@ -69,7 +70,7 @@ const StyledContainer = styled(ToastContainer)`
|
|||||||
export default function App() {
|
export default function App() {
|
||||||
const {
|
const {
|
||||||
bodyStyle, setBodyStyle,
|
bodyStyle, setBodyStyle,
|
||||||
setDefaultSubplebbits,
|
defaultSubplebbits, setDefaultSubplebbits,
|
||||||
isCaptchaOpen, setIsCaptchaOpen,
|
isCaptchaOpen, setIsCaptchaOpen,
|
||||||
setIsSettingsOpen,
|
setIsSettingsOpen,
|
||||||
selectedStyle, setSelectedStyle,
|
selectedStyle, setSelectedStyle,
|
||||||
@@ -80,6 +81,18 @@ export default function App() {
|
|||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
const isHomeRoute = location.pathname === "/";
|
const isHomeRoute = location.pathname === "/";
|
||||||
|
|
||||||
|
const account = useAccount();
|
||||||
|
|
||||||
|
// preload default subs and subscriptions
|
||||||
|
useBufferedFeeds({
|
||||||
|
feedsOptions: [
|
||||||
|
{subplebbitAddresses: defaultSubplebbits.map(
|
||||||
|
(subplebbit) => subplebbit.address
|
||||||
|
), sortType: 'new'},
|
||||||
|
{subplebbitAddresses: account.subscriptions, sortType: 'new'}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
// preload banners
|
// preload banners
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const loadImages = async () => {
|
const loadImages = async () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user