Fix promise error with fetching followed hashtags

Remove memoization for now
This commit is contained in:
Lim Chee Aun 2023-11-06 23:31:00 +08:00
parent b027967168
commit a8cf7879a2

View file

@ -466,15 +466,6 @@ const fetchLists = pmem(
maxAge: FETCH_MAX_AGE, maxAge: FETCH_MAX_AGE,
}, },
); );
const fetchFollowedHashtags = pmem(
() => {
const { masto } = api();
return masto.v1.followedTags.list();
},
{
maxAge: FETCH_MAX_AGE,
},
);
function ShortcutForm({ function ShortcutForm({
onSubmit, onSubmit,
@ -486,6 +477,7 @@ function ShortcutForm({
console.log('shortcut', shortcut); console.log('shortcut', shortcut);
const editMode = !!shortcut; const editMode = !!shortcut;
const [currentType, setCurrentType] = useState(shortcut?.type || null); const [currentType, setCurrentType] = useState(shortcut?.type || null);
const { masto } = api();
const [uiState, setUIState] = useState('default'); const [uiState, setUIState] = useState('default');
const [lists, setLists] = useState([]); const [lists, setLists] = useState([]);
@ -508,7 +500,7 @@ function ShortcutForm({
(async () => { (async () => {
if (currentType !== 'hashtag') return; if (currentType !== 'hashtag') return;
try { try {
const iterator = fetchFollowedHashtags(); const iterator = masto.v1.followedTags.list();
const tags = []; const tags = [];
do { do {
const { value, done } = await iterator.next(); const { value, done } = await iterator.next();