Merge branch '1307-post-content-is-lost-when-editing' into 'main'

post data are correctly restored when editing

See merge request framasoft/mobilizon!1563
This commit is contained in:
setop 2024-06-26 09:57:06 +00:00
commit cde54249a9

View file

@ -195,6 +195,10 @@ onMounted(async () => {
pictureFile.value = await buildFileFromIMedia(post.value?.picture);
});
// This is useful when post data is already cached from the API during navigation inside the app
editablePost.value = { ...editablePost.value, ...post.value };
// This watch() function is useful when post data loads directly from the API upon page load
watch(post, async (newPost: IPost | undefined, oldPost: IPost | undefined) => {
if (oldPost?.picture !== newPost?.picture) {
pictureFile.value = await buildFileFromIMedia(post.value?.picture);