From 36830e3cd14fa87d2f52a6f37ae423c71e3608c2 Mon Sep 17 00:00:00 2001 From: Hermes Agent Date: Wed, 15 Apr 2026 07:43:00 +0000 Subject: [PATCH] fix: invalidate cron skill picker cache on form open and after skill save (#502) Two complementary cache-busting strategies for the stale cron skill picker: 1. On cron form open (toggleCronForm): always null _cronSkillsCache before fetching, so freshly created skills are immediately visible without a page reload. Previously the cache was only populated once and never invalidated. 2. On skill save (submitSkillSave): null _cronSkillsCache after a successful write so the next cron form open is forced to re-fetch. Mirrors the existing _skillsData=null pattern one line above. Fixes: #502 Co-authored-by: armorbreak001 --- static/panels.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/static/panels.js b/static/panels.js index 237ab65..d509fb7 100644 --- a/static/panels.js +++ b/static/panels.js @@ -97,10 +97,9 @@ function toggleCronForm(){ _renderCronSkillTags(); const search=$('cronFormSkillSearch'); if(search)search.value=''; - // Pre-fetch skills for the picker - if(!_cronSkillsCache){ - api('/api/skills').then(d=>{_cronSkillsCache=d.skills||[];}).catch(()=>{}); - } + // Always re-fetch skills to avoid stale cache + _cronSkillsCache=null; + api('/api/skills').then(d=>{_cronSkillsCache=d.skills||[];}).catch(()=>{}); $('cronFormName').focus(); } } @@ -485,6 +484,7 @@ async function submitSkillSave() { await api('/api/skills/save', {method:'POST', body: JSON.stringify({name, category: category||undefined, content})}); showToast(_editingSkillName ? t('skill_updated') : t('skill_created')); _skillsData = null; + _cronSkillsCache = null; toggleSkillForm(); await loadSkills(); } catch(e) { errEl.textContent = t('error_prefix') + e.message; errEl.style.display = ''; }