From 4deacaa9a8810f1c19d4bc4d3b611d991849ce67 Mon Sep 17 00:00:00 2001 From: "Rasamoelina, Haja Onjatiana" <26148770+rhahao@users.noreply.github.com> Date: Mon, 3 Oct 2022 17:27:31 +0300 Subject: [PATCH] fix(source material): refresh years list after source material update --- src/epub/epubParser.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/epub/epubParser.js b/src/epub/epubParser.js index 10b04858..03d03cd9 100644 --- a/src/epub/epubParser.js +++ b/src/epub/epubParser.js @@ -1,9 +1,9 @@ import { loadEPUB } from 'jw-epub-parser'; import dateFormat from 'dateformat'; -import { promiseGetRecoil } from 'recoil-outside'; -import { dbSaveSrcData } from '../indexedDb/dbSourceMaterial'; +import { promiseGetRecoil, promiseSetRecoil } from 'recoil-outside'; +import { dbSaveSrcData, dbGetYearList } from '../indexedDb/dbSourceMaterial'; import { monthNamesState } from '../appStates/appSettings'; -import { assTypeLocalState } from '../appStates/appSourceMaterial'; +import { assTypeLocalState, yearsListState } from '../appStates/appSourceMaterial'; export const addEpubDataToDb = async (fileEPUB) => { const data = await loadEPUB(fileEPUB); @@ -202,6 +202,9 @@ const addDataToDb = async (data) => { await dbSaveSrcData(obj); } + + const years = await dbGetYearList(); + await promiseSetRecoil(yearsListState, years); } catch (err) { return 'error'; }