mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-02-08 17:16:25 +01:00
Auto-threadify when open a status page with context
This commit is contained in:
parent
162fc7ad07
commit
e2b6f2df6a
2 changed files with 7 additions and 2 deletions
|
@ -14,7 +14,7 @@ import RelativeTime from '../components/relative-time';
|
||||||
import Status from '../components/status';
|
import Status from '../components/status';
|
||||||
import htmlContentLength from '../utils/html-content-length';
|
import htmlContentLength from '../utils/html-content-length';
|
||||||
import shortenNumber from '../utils/shorten-number';
|
import shortenNumber from '../utils/shorten-number';
|
||||||
import states, { saveStatus } from '../utils/states';
|
import states, { saveStatus, threadifyStatus } from '../utils/states';
|
||||||
import store from '../utils/store';
|
import store from '../utils/store';
|
||||||
import { getCurrentAccount } from '../utils/store-utils';
|
import { getCurrentAccount } from '../utils/store-utils';
|
||||||
import useDebouncedCallback from '../utils/useDebouncedCallback';
|
import useDebouncedCallback from '../utils/useDebouncedCallback';
|
||||||
|
@ -160,6 +160,11 @@ function StatusPage({ id }) {
|
||||||
console.log({ allStatuses });
|
console.log({ allStatuses });
|
||||||
setStatuses(allStatuses);
|
setStatuses(allStatuses);
|
||||||
cachedStatusesMap.current[id] = allStatuses;
|
cachedStatusesMap.current[id] = allStatuses;
|
||||||
|
|
||||||
|
// Let's threadify this one
|
||||||
|
// Note that all non-hero statuses will trigger saveStatus which will threadify them too
|
||||||
|
// By right, at this point, all descendant statuses should be cached
|
||||||
|
threadifyStatus(heroStatus);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
setUIState('error');
|
setUIState('error');
|
||||||
|
|
|
@ -45,7 +45,7 @@ export function saveStatus(status, opts) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function threadifyStatus(status) {
|
export function threadifyStatus(status) {
|
||||||
// Return all statuses in the thread, via inReplyToId, if inReplyToAccountId === account.id
|
// Return all statuses in the thread, via inReplyToId, if inReplyToAccountId === account.id
|
||||||
let fetchIndex = 0;
|
let fetchIndex = 0;
|
||||||
async function traverse(status, index = 0) {
|
async function traverse(status, index = 0) {
|
||||||
|
|
Loading…
Reference in a new issue