From 7f440d09acee047beac70c0880ac3a1d824b9288 Mon Sep 17 00:00:00 2001 From: Codex Date: Fri, 4 Dec 2026 22:45:01 +0000 Subject: [PATCH] Load Context Intent before checking its draft guard --- PlotLine.Tests/Browser/context-intent-palette-acceptance.cjs | 4 ++++ PlotLine/wwwroot/js/context-workspace.js | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/PlotLine.Tests/Browser/context-intent-palette-acceptance.cjs b/PlotLine.Tests/Browser/context-intent-palette-acceptance.cjs index afbcba5d..1fb47a2b 100644 --- a/PlotLine.Tests/Browser/context-intent-palette-acceptance.cjs +++ b/PlotLine.Tests/Browser/context-intent-palette-acceptance.cjs @@ -36,6 +36,10 @@ let session, stage = 'login'; const items = checklist.locator('[data-checklist-items] > li'); const getChecklist = () => session.page.evaluate(async ({bookID,chapterID}) => (await fetch('/Writing/Context/Intent/Checklist?' + new URLSearchParams({bookID,chapterID}))).json(), base); + stage='empty chapter Intent controls'; + await checklist.getByText('No checklist items',{exact:true}).waitFor({state:'visible'}); + await checklist.getByRole('button',{name:'Add item',exact:true}).waitFor({state:'visible'}); + await session.page.locator('[data-intent-palette]').getByText('Story Elements',{exact:true}).waitFor({state:'visible'}); await checklist.getByText('Paste a checklist', {exact:true}).click(); await checklist.getByLabel('Checklist text').fill('- [ ] Reveal the promise\n- [ ] Establish the setting'); await checklist.getByRole('button',{name:'Preview',exact:true}).click(); diff --git a/PlotLine/wwwroot/js/context-workspace.js b/PlotLine/wwwroot/js/context-workspace.js index 90b7fe25..86c0eac8 100644 --- a/PlotLine/wwwroot/js/context-workspace.js +++ b/PlotLine/wwwroot/js/context-workspace.js @@ -47,7 +47,7 @@ const panes = [...root.querySelectorAll('[data-context-pane]')].map((element,index)=>({ element,index,select:element.querySelector('[data-context-tab]'),host:element.querySelector('[data-context-pane-content]'),status:element.querySelector('[data-context-pane-status]'),records:new Map(),revision:0 })); const current = pane => pane.records.get(state.panes[pane.index].tab); const visible = pane => pane.index===0 || state.layout!=='single'; - const guarded = record => record && (record.dirty || record.busy || lifecycles[record.tab.lifecycle]?.canRefresh?.(record.node,record)===false); + const guarded = record => record?.node && (record.dirty || record.busy || lifecycles[record.tab.lifecycle]?.canRefresh?.(record.node,record)===false); function remember(pane) { const record=pane.host.contextRecord; if(!record)return; record.scroll={top:pane.host.scrollTop,left:pane.host.scrollLeft};