mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-03-23 22:14:42 +01:00
Make fetches concurrent
This commit is contained in:
parent
fe78ac5fa0
commit
a2e55eca90
1 changed files with 5 additions and 2 deletions
|
@ -67,10 +67,13 @@ function StatusPage({ id }) {
|
||||||
}
|
}
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
|
const heroFetch = masto.statuses.fetch(id);
|
||||||
|
const contextFetch = masto.statuses.fetchContext(id);
|
||||||
|
|
||||||
const hasStatus = snapStates.statuses.has(id);
|
const hasStatus = snapStates.statuses.has(id);
|
||||||
let heroStatus = snapStates.statuses.get(id);
|
let heroStatus = snapStates.statuses.get(id);
|
||||||
try {
|
try {
|
||||||
heroStatus = await masto.statuses.fetch(id);
|
heroStatus = await heroFetch;
|
||||||
states.statuses.set(id, heroStatus);
|
states.statuses.set(id, heroStatus);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// Silent fail if status is cached
|
// Silent fail if status is cached
|
||||||
|
@ -82,7 +85,7 @@ function StatusPage({ id }) {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const context = await masto.statuses.fetchContext(id);
|
const context = await contextFetch;
|
||||||
const { ancestors, descendants } = context;
|
const { ancestors, descendants } = context;
|
||||||
|
|
||||||
ancestors.forEach((status) => {
|
ancestors.forEach((status) => {
|
||||||
|
|
Loading…
Add table
Reference in a new issue