bucket handling fixes better
This commit is contained in:
@@ -9,6 +9,8 @@ export const QuickEntry: Component = () => {
|
|||||||
const [isOpen, setIsOpen] = createSignal(false);
|
const [isOpen, setIsOpen] = createSignal(false);
|
||||||
// Autofill tags based on context when opening
|
// Autofill tags based on context when opening
|
||||||
const initialTags = createMemo(() => {
|
const initialTags = createMemo(() => {
|
||||||
|
if (!isOpen()) return [];
|
||||||
|
|
||||||
const tags: string[] = [];
|
const tags: string[] = [];
|
||||||
const ctx = currentTaskContext();
|
const ctx = currentTaskContext();
|
||||||
|
|
||||||
|
|||||||
@@ -44,23 +44,18 @@ export const QuickEntryForm: Component<QuickEntryFormProps> = (props) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Reactive sync from props (handles context changes while open)
|
// Reactive sync from props (handles context changes while open)
|
||||||
let lastInitialTags: string[] = [];
|
|
||||||
createEffect(() => {
|
createEffect(() => {
|
||||||
const initial = props.initialTags || [];
|
const initial = props.initialTags || [];
|
||||||
|
if (initial.length > 0) {
|
||||||
setTags(prev => {
|
setTags(prev => {
|
||||||
// 1. Identify context tags that were removed
|
// Merge initial tags if not already present
|
||||||
const removed = lastInitialTags.filter(t => !initial.includes(t));
|
const next = [...prev];
|
||||||
// 2. Filter them out of the current tag list
|
initial.forEach(t => {
|
||||||
let next = prev.filter(t => !removed.includes(t));
|
if (!next.includes(t)) next.push(t);
|
||||||
// 3. Add new context tags that aren't already present
|
});
|
||||||
initial.forEach(t => {
|
return next;
|
||||||
if (!next.includes(t)) next.push(t);
|
|
||||||
});
|
});
|
||||||
return next;
|
}
|
||||||
});
|
|
||||||
|
|
||||||
lastInitialTags = [...initial];
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Reactive shorthand parsing
|
// Reactive shorthand parsing
|
||||||
|
|||||||
Reference in New Issue
Block a user