Stickers now updating in local state, the context state is not.

This commit is contained in:
Lucid Kobold
2022-02-10 01:57:54 -06:00
parent af57b29e2d
commit 609882fd1e
7 changed files with 51 additions and 45 deletions

View File

@@ -14,8 +14,8 @@ const StickersContextProvider = ({
);
// TODO: Add stickers functions here. (Add and edit stickers).
const addEditSticker = (date: Date, sticker: ValidStickerVal): void => {
const newStickersMonth = [...stickersMonth];
const addEditSticker = (date: Date, sticker: ValidStickerVal): Sticker => {
const newStickersMonth = stickersMonth.slice();
const index = getDate(date) - 1;
const currDate = newStickersMonth[index];
@@ -35,11 +35,13 @@ const StickersContextProvider = ({
sticker: sticker,
edited: edited,
manual: false
}
};
newStickersMonth[index] = newSticker;
setStickersMonth(newStickersMonth);
setStickersMonth(newStickersMonth.slice());
return newSticker;
};
// TODO: Add stickers validation function here.