mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-03-14 04:08:32 +03:00
Time to save all to states
Memory usage might go up but need this for reactivity
This commit is contained in:
parent
4af3287f0d
commit
a0d4d9e08c
4 changed files with 24 additions and 0 deletions
|
@ -7,6 +7,7 @@ import Timeline from '../components/timeline';
|
|||
import { api } from '../utils/api';
|
||||
import emojifyText from '../utils/emojify-text';
|
||||
import states from '../utils/states';
|
||||
import { saveStatus } from '../utils/states';
|
||||
import useTitle from '../utils/useTitle';
|
||||
|
||||
const LIMIT = 20;
|
||||
|
@ -48,6 +49,10 @@ function AccountStatuses() {
|
|||
const { value, done } = await accountStatusesIterator.current.next();
|
||||
if (value?.length) {
|
||||
results.push(...value);
|
||||
|
||||
value.forEach((item) => {
|
||||
saveStatus(item, instance);
|
||||
});
|
||||
}
|
||||
return {
|
||||
value: results,
|
||||
|
@ -118,6 +123,7 @@ function AccountStatuses() {
|
|||
emptyText="Nothing to see here yet."
|
||||
errorText="Unable to load statuses"
|
||||
fetchItems={fetchAccountStatuses}
|
||||
useItemID
|
||||
boostsCarousel={snapStates.settings.boostsCarousel}
|
||||
timelineStart={TimelineStart}
|
||||
/>
|
||||
|
|
|
@ -13,6 +13,7 @@ import Timeline from '../components/timeline';
|
|||
import { api } from '../utils/api';
|
||||
import showToast from '../utils/show-toast';
|
||||
import states from '../utils/states';
|
||||
import { saveStatus } from '../utils/states';
|
||||
import useTitle from '../utils/useTitle';
|
||||
|
||||
const LIMIT = 20;
|
||||
|
@ -52,6 +53,10 @@ function Hashtags(props) {
|
|||
if (firstLoad) {
|
||||
latestItem.current = value[0].id;
|
||||
}
|
||||
|
||||
value.forEach((item) => {
|
||||
saveStatus(item, instance);
|
||||
});
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
@ -110,6 +115,7 @@ function Hashtags(props) {
|
|||
errorText="Unable to load posts with this tag"
|
||||
fetchItems={fetchHashtags}
|
||||
checkForUpdates={checkForUpdates}
|
||||
useItemID
|
||||
headerEnd={
|
||||
<Menu
|
||||
portal={{
|
||||
|
|
|
@ -5,6 +5,7 @@ import Icon from '../components/icon';
|
|||
import Link from '../components/link';
|
||||
import Timeline from '../components/timeline';
|
||||
import { api } from '../utils/api';
|
||||
import { saveStatus } from '../utils/states';
|
||||
import useTitle from '../utils/useTitle';
|
||||
|
||||
const LIMIT = 20;
|
||||
|
@ -27,6 +28,10 @@ function List(props) {
|
|||
if (firstLoad) {
|
||||
latestItem.current = value[0].id;
|
||||
}
|
||||
|
||||
value.forEach((item) => {
|
||||
saveStatus(item, instance);
|
||||
});
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
@ -69,6 +74,7 @@ function List(props) {
|
|||
instance={instance}
|
||||
fetchItems={fetchList}
|
||||
checkForUpdates={checkForUpdates}
|
||||
useItemID
|
||||
boostsCarousel
|
||||
headerStart={
|
||||
<Link to="/l" class="button plain">
|
||||
|
|
|
@ -7,6 +7,7 @@ import Icon from '../components/icon';
|
|||
import Timeline from '../components/timeline';
|
||||
import { api } from '../utils/api';
|
||||
import states from '../utils/states';
|
||||
import { saveStatus } from '../utils/states';
|
||||
import useTitle from '../utils/useTitle';
|
||||
|
||||
const LIMIT = 20;
|
||||
|
@ -37,6 +38,10 @@ function Public({ local, ...props }) {
|
|||
if (firstLoad) {
|
||||
latestItem.current = value[0].id;
|
||||
}
|
||||
|
||||
value.forEach((item) => {
|
||||
saveStatus(item, instance);
|
||||
});
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
@ -76,6 +81,7 @@ function Public({ local, ...props }) {
|
|||
errorText="Unable to load posts"
|
||||
fetchItems={fetchPublic}
|
||||
checkForUpdates={checkForUpdates}
|
||||
useItemID
|
||||
headerStart={<></>}
|
||||
boostsCarousel={snapStates.settings.boostsCarousel}
|
||||
headerEnd={
|
||||
|
|
Loading…
Add table
Reference in a new issue