mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-03-23 06:09:21 +01:00
Fix serious bug: any
doesn't persist in subsequent calls
This commit is contained in:
parent
fcc7d8ddea
commit
465c06c671
1 changed files with 18 additions and 6 deletions
|
@ -42,15 +42,25 @@ function Hashtags(props) {
|
||||||
useTitle(title, `/:instance?/t/:hashtag`);
|
useTitle(title, `/:instance?/t/:hashtag`);
|
||||||
const latestItem = useRef();
|
const latestItem = useRef();
|
||||||
|
|
||||||
const hashtagsIterator = useRef();
|
// const hashtagsIterator = useRef();
|
||||||
|
const maxID = useRef(undefined);
|
||||||
async function fetchHashtags(firstLoad) {
|
async function fetchHashtags(firstLoad) {
|
||||||
if (firstLoad || !hashtagsIterator.current) {
|
// if (firstLoad || !hashtagsIterator.current) {
|
||||||
hashtagsIterator.current = masto.v1.timelines.listHashtag(hashtag, {
|
// hashtagsIterator.current = masto.v1.timelines.listHashtag(hashtag, {
|
||||||
|
// limit: LIMIT,
|
||||||
|
// any: hashtags.slice(1),
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// const results = await hashtagsIterator.current.next();
|
||||||
|
|
||||||
|
// NOTE: Temporary fix for listHashtag not persisting `any` in subsequent calls.
|
||||||
|
const results = await masto.v1.timelines
|
||||||
|
.listHashtag(hashtag, {
|
||||||
limit: LIMIT,
|
limit: LIMIT,
|
||||||
any: hashtags.slice(1),
|
any: hashtags.slice(1),
|
||||||
});
|
maxId: firstLoad ? undefined : maxID.current,
|
||||||
}
|
})
|
||||||
const results = await hashtagsIterator.current.next();
|
.next();
|
||||||
const { value } = results;
|
const { value } = results;
|
||||||
if (value?.length) {
|
if (value?.length) {
|
||||||
if (firstLoad) {
|
if (firstLoad) {
|
||||||
|
@ -60,6 +70,8 @@ function Hashtags(props) {
|
||||||
value.forEach((item) => {
|
value.forEach((item) => {
|
||||||
saveStatus(item, instance);
|
saveStatus(item, instance);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
maxID.current = value[value.length - 1].id;
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
...results,
|
...results,
|
||||||
|
|
Loading…
Add table
Reference in a new issue