mirror of
https://github.com/lumehq/lume.git
synced 2025-09-28 23:13:51 +02:00
support ssr when build app
This commit is contained in:
@@ -2,7 +2,7 @@ import { createContext } from 'react';
|
|||||||
|
|
||||||
export const AccountContext = createContext({});
|
export const AccountContext = createContext({});
|
||||||
|
|
||||||
let activeAccount: any = null;
|
let activeAccount: any = { id: '', pubkey: '', follows: null, metadata: '' };
|
||||||
|
|
||||||
if (typeof window !== 'undefined') {
|
if (typeof window !== 'undefined') {
|
||||||
const { getActiveAccount } = await import('@utils/storage');
|
const { getActiveAccount } = await import('@utils/storage');
|
||||||
|
@@ -17,7 +17,7 @@ export default function EventCollector() {
|
|||||||
const activeAccount: any = useContext(AccountContext);
|
const activeAccount: any = useContext(AccountContext);
|
||||||
|
|
||||||
const setHasNewerNote = useSetAtom(hasNewerNoteAtom);
|
const setHasNewerNote = useSetAtom(hasNewerNoteAtom);
|
||||||
const follows = activeAccount ? JSON.parse(activeAccount.follows) : [];
|
const follows = activeAccount.follows ? JSON.parse(activeAccount.follows) : [];
|
||||||
|
|
||||||
const now = useRef(new Date());
|
const now = useRef(new Date());
|
||||||
|
|
||||||
|
@@ -59,8 +59,8 @@ export function Page() {
|
|||||||
const pageContext = usePageContext();
|
const pageContext = usePageContext();
|
||||||
const searchParams: any = pageContext.urlParsed.search;
|
const searchParams: any = pageContext.urlParsed.search;
|
||||||
|
|
||||||
const pubkey = searchParams.pubkey;
|
const pubkey = searchParams.pubkey || '';
|
||||||
const privkey = searchParams.privkey;
|
const privkey = searchParams.privkey || '';
|
||||||
|
|
||||||
const pool: any = useContext(RelayContext);
|
const pool: any = useContext(RelayContext);
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
@@ -18,7 +18,7 @@ export function Page() {
|
|||||||
const searchParams = pageContext.urlParsed.search;
|
const searchParams = pageContext.urlParsed.search;
|
||||||
|
|
||||||
const privkey = searchParams.privkey;
|
const privkey = searchParams.privkey;
|
||||||
const pubkey = useMemo(() => getPublicKey(privkey), [privkey]);
|
const pubkey = useMemo(() => (privkey ? getPublicKey(privkey) : ''), [privkey]);
|
||||||
|
|
||||||
const pool: any = useContext(RelayContext);
|
const pool: any = useContext(RelayContext);
|
||||||
const [profile, setProfile] = useState({ metadata: null });
|
const [profile, setProfile] = useState({ metadata: null });
|
@@ -1,5 +1,3 @@
|
|||||||
'use client';
|
|
||||||
|
|
||||||
import NewsfeedLayout from '@components/layouts/newsfeed';
|
import NewsfeedLayout from '@components/layouts/newsfeed';
|
||||||
import ProfileFollowers from '@components/profile/followers';
|
import ProfileFollowers from '@components/profile/followers';
|
||||||
import ProfileFollows from '@components/profile/follows';
|
import ProfileFollows from '@components/profile/follows';
|
Reference in New Issue
Block a user