Hello. When deleting an item in the media list the first time it runs the list function as expected, but not the second time. media:list:start is not fired after a successful second delete.
const media = {
accept: '*',
list: (options) =>
new Promise((resolve) => {
const _list = async () => {
const items = await tinaUploadListRefresh({
...options,
});
resolve(items?.data?.media_list ?? { items: [] });
};
_list();
}),
delete: (item) =>
new Promise((resolve) => {
const _delete = async () => {
await deleteTinaUpload({
variables: { id: item.id },
});
resolve();
};
_delete();
}),
persist: (files) =>
new Promise((resolve) => {
const _add = async () => {
const item = await addTinaUpload();
resolve(item.data.tina_upload);
};
_add();
}),
};
const cms = new TinaCMS({
media,
});
Whenever something's deleted it should re-list (in my opinion).
First delete triggers a re-list, second does not.
โโโฌ [email protected]
โโโฌ [email protected]
โโโฌ [email protected]
โโโฌ UNMET PEER DEPENDENCY [email protected]
โ โโโ @tinacms/[email protected]
โ โโโ @tinacms/[email protected]
โ โโโฌ @tinacms/[email protected]
โ โโโฌ @tinacms/[email protected]
โ โโโฌ @tinacms/[email protected]
โ โโโ @tinacms/[email protected]
โ โโโ @tinacms/[email protected]
โ โโโฌ @tinacms/[email protected]
โ โโโฌ @tinacms/[email protected]
โ โโโ @tinacms/[email protected]
โ โโโ @tinacms/[email protected]
โ โโโฌ @tinacms/[email protected]
โ โโโฌ @tinacms/[email protected]
โ โโโฌ @tinacms/[email protected]
โโโฌ [email protected]
โโโฌ [email protected]
| Tool | Version |
| ------- | ------- |
| browser | Chrome |
| os | Mac 10.15.7 |
| node | 14.5 |
| npm | 6.14.5 |
After opening this I rearranged my setup (React code) to create my TinaCms instance only once in a useEffect, whereas before it was creating a new instance every render, and it works as expected now.
Most helpful comment
After opening this I rearranged my setup (React code) to create my TinaCms instance only once in a
useEffect, whereas before it was creating a new instance every render, and it works as expected now.