diff --git a/backend/src/plugins/scheduler.js b/backend/src/plugins/scheduler.js index 2cfbd71..649fdf6 100644 --- a/backend/src/plugins/scheduler.js +++ b/backend/src/plugins/scheduler.js @@ -72,13 +72,17 @@ async function schedulerPlugin(fastify, opts) { try { const result = await syncFn(bot); const status = await getStatus(botId); - await updateStatus(botId, { + const updateData = { status: 'running', lastCheckAt: new Date().toISOString(), - lastAddedCount: result.addedCount, totalAdded: (status.totalAdded || 0) + result.addedCount, errorMessage: null, - }); + }; + // 실제로 추가된 경우에만 lastAddedCount 업데이트 + if (result.addedCount > 0) { + updateData.lastAddedCount = result.addedCount; + } + await updateStatus(botId, updateData); fastify.log.info(`[${botId}] 동기화 완료: ${result.addedCount}개 추가`); } catch (err) { await updateStatus(botId, { @@ -98,11 +102,15 @@ async function schedulerPlugin(fastify, opts) { try { const result = await syncFn(bot); const status = await getStatus(botId); - await updateStatus(botId, { + const updateData = { lastCheckAt: new Date().toISOString(), - lastAddedCount: result.addedCount, totalAdded: (status.totalAdded || 0) + result.addedCount, - }); + }; + // 실제로 추가된 경우에만 lastAddedCount 업데이트 + if (result.addedCount > 0) { + updateData.lastAddedCount = result.addedCount; + } + await updateStatus(botId, updateData); fastify.log.info(`[${botId}] 초기 동기화 완료: ${result.addedCount}개 추가`); } catch (err) { fastify.log.error(`[${botId}] 초기 동기화 오류: ${err.message}`); diff --git a/frontend/src/pages/pc/admin/schedule/form/index.jsx b/frontend/src/pages/pc/admin/schedule/form/index.jsx index 07bd1b4..6d09428 100644 --- a/frontend/src/pages/pc/admin/schedule/form/index.jsx +++ b/frontend/src/pages/pc/admin/schedule/form/index.jsx @@ -29,20 +29,6 @@ const itemVariants = { }, }; -const formVariants = { - hidden: { opacity: 0, y: 20 }, - visible: { - opacity: 1, - y: 0, - transition: { duration: 0.3, ease: "easeOut", delay: 0.3 }, - }, - exit: { - opacity: 0, - y: -10, - transition: { duration: 0.2 }, - }, -}; - // 카테고리 ID 상수 const CATEGORY_IDS = { YOUTUBE: 2, @@ -59,6 +45,7 @@ function ScheduleFormPage() { const [categories, setCategories] = useState([]); const [selectedCategory, setSelectedCategory] = useState(null); const [loading, setLoading] = useState(true); + const [isInitialLoad, setIsInitialLoad] = useState(true); // 카테고리 로드 useEffect(() => { @@ -160,7 +147,10 @@ function ScheduleFormPage() { { + setSelectedCategory(id); + setIsInitialLoad(false); + }} /> @@ -168,10 +158,17 @@ function ScheduleFormPage() { {renderForm()}