1
0
Fork 0
mirror of https://github.com/mealie-recipes/mealie.git synced 2025-07-24 23:59:45 +02:00

fix(frontend): 🐛 fix section titles carrying over on deleted items (#765)

* fix(frontend): 🐛 fix section titles carrying over on deleted items

Added a UUID generator to generate unique id's and prevent list changes from causing proper virtual dom re-renders.

* lazy load json editor

* fix ingredient rendering error

* move text to input

* update settings styling

* improve mobile view

Co-authored-by: Hayden <hay-kot@pm.me>
This commit is contained in:
Hayden 2021-10-31 14:46:46 -08:00 committed by GitHub
parent 909bc85205
commit 40462a95f1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 195 additions and 88 deletions

View file

@ -14,9 +14,17 @@ export const useRecipeContext = function () {
}, slug);
loading.value = false;
return recipe;
}
async function fetchRecipe(slug: string) {
loading.value = true;
const { data } = await api.recipes.getOne(slug);
loading.value = false;
return data;
}
async function deleteRecipe(slug: string) {
loading.value = true;
const { data } = await api.recipes.deleteOne(slug);
@ -31,5 +39,5 @@ export const useRecipeContext = function () {
return data;
}
return { loading, getBySlug, deleteRecipe, updateRecipe };
return { loading, getBySlug, deleteRecipe, updateRecipe, fetchRecipe };
};

View file

@ -0,0 +1,12 @@
const max = 1000000;
export function uniqueId() {
return Date.now() + Math.random() * max;
}
export function uuid4() {
// @ts-ignore
return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, (c) =>
(c ^ (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (c / 4)))).toString(16)
);
}