added useMetadata and refactor user component
This commit is contained in:
@@ -54,8 +54,7 @@ export default function Page() {
|
||||
limit: limit.current,
|
||||
offset: offset.current,
|
||||
});
|
||||
const filteredResult = filteredData(result);
|
||||
setData((data) => [...data, ...filteredResult]);
|
||||
setData((data) => [...data, ...result]);
|
||||
}, []);
|
||||
|
||||
const loadMore = useCallback(async () => {
|
||||
@@ -67,8 +66,7 @@ export default function Page() {
|
||||
limit: limit.current,
|
||||
offset: offset.current,
|
||||
});
|
||||
const filteredResult = filteredData(result);
|
||||
setData((data) => [...data, ...filteredResult]);
|
||||
setData((data) => [...data, ...result]);
|
||||
}, []);
|
||||
|
||||
const loadLatest = useCallback(async () => {
|
||||
@@ -76,8 +74,7 @@ export default function Page() {
|
||||
// next query
|
||||
const result: any = await getLatestNotes({ date: dateToUnix(now.current) });
|
||||
// update data
|
||||
const filteredResult = filteredData(result);
|
||||
setData((data) => [...data, ...filteredResult]);
|
||||
setData((data) => [...data, ...result]);
|
||||
// hide newer trigger
|
||||
setHasNewerNote(false);
|
||||
// scroll to top
|
||||
@@ -103,7 +100,7 @@ export default function Page() {
|
||||
)}
|
||||
<Virtuoso
|
||||
ref={virtuosoRef}
|
||||
data={data}
|
||||
data={filteredData(data)}
|
||||
itemContent={itemContent}
|
||||
computeItemKey={computeItemKey}
|
||||
components={COMPONENTS}
|
||||
|
||||
@@ -85,9 +85,13 @@ export default function Page() {
|
||||
|
||||
for (const follow of follows) {
|
||||
const metadata: any = await fetchMetadata(follow, pool, relays);
|
||||
createPleb({ pubkey: follow, kind: 0, metadata: metadata.content, account_id: parseInt(id) }).catch(
|
||||
console.error
|
||||
);
|
||||
createPleb({
|
||||
pleb_id: follow + '-lume' + id,
|
||||
pubkey: follow,
|
||||
kind: 0,
|
||||
metadata: metadata.content,
|
||||
account_id: parseInt(id),
|
||||
}).catch(console.error);
|
||||
}
|
||||
|
||||
// build event
|
||||
|
||||
@@ -50,9 +50,13 @@ export default function Page() {
|
||||
if (profile?.id !== null) {
|
||||
for (const tag of tags) {
|
||||
const metadata: any = await fetchMetadata(tag[1], pool, relays);
|
||||
createPleb({ pubkey: tag[1], kind: 0, metadata: metadata.content, account_id: profile.id }).catch(
|
||||
console.error
|
||||
);
|
||||
createPleb({
|
||||
pleb_id: tag[1] + '-lume' + profile.id.toString(),
|
||||
pubkey: tag[1],
|
||||
kind: 0,
|
||||
metadata: metadata.content,
|
||||
account_id: profile.id,
|
||||
}).catch(console.error);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user