Skip to content

Private AI meeting notes that stay on your computer. No meeting bot. Free and open source for Mac, Windows and Linux. An alternative to Granola, Otter and Fireflies.

Ask: the rim flare always finishes, even while you type

Eric Brownrout61c0e1da78c4
diff --git a/app/src/shared/askTracer.ts b/app/src/shared/askTracer.ts
index a6c647dd..e9f75e69 100644
--- a/app/src/shared/askTracer.ts
+++ b/app/src/shared/askTracer.ts
@@ -7,16 +7,16 @@ export type TracerState = { focused: boolean; hovered: boolean; hasText: boolean
/** One scheduler per panel opening; only the opening lap may ignore autofocus. */
export function createTracerSchedule(initial: TracerState, play: () => void, stop: () => void) {
- let state = initial, opening = true, disposed = false
+ let state = initial, opening = true, running = false, disposed = false
let timer: ReturnType<typeof setTimeout> | undefined
// The opening lap plays the same however the panel opened: a pointer on the box (as after clicking Ask) only skips idle laps.
const allowed = () => !state.hasText && !state.reduced && !state.hidden && (opening || !state.focused && !state.hovered)
- const cancel = () => { clearTimeout(timer); timer = undefined; stop() }
+ const cancel = () => { clearTimeout(timer); timer = undefined; running = false; stop() }
const schedule = (delay: number) => {
timer = setTimeout(() => {
- play()
+ running = true; play()
timer = setTimeout(() => {
- stop(); timer = undefined; opening = false
+ stop(); timer = undefined; running = false; opening = false
if (allowed()) schedule(TRACER_CADENCE_MS - TRACER_LAP_MS)
}, TRACER_LAP_MS)
}, delay)
@@ -24,6 +24,8 @@ export function createTracerSchedule(initial: TracerState, play: () => void, sto
const update = (next: TracerState) => {
if (disposed) return
state = next
+ // Input only gates the next lap; let the current one finish at its original deadline.
+ if (running && !state.reduced && !state.hidden) return
if (!allowed()) { opening = false; cancel() }
else if (timer === undefined) schedule(opening ? TRACER_DELAY_MS : TRACER_CADENCE_MS)
}
diff --git a/app/test/askTracer.test.ts b/app/test/askTracer.test.ts
index 9143d6e3..b8668ba9 100644
--- a/app/test/askTracer.test.ts
+++ b/app/test/askTracer.test.ts
@@ -40,7 +40,7 @@ it.each(['hasText', 'reduced', 'hidden'] as const)('suppresses opening with %s,
s.dispose()
})
-it.each(['hasText', 'reduced', 'hidden'] as const)('cancels a running opening on %s and waits a full idle interval', flag => {
+it.each(['reduced', 'hidden'] as const)('cancels a running opening on %s and waits a full idle interval', flag => {
const s = setup()
vi.advanceTimersByTime(TRACER_DELAY_MS)
expect(s.play).toHaveBeenCalledTimes(1)
@@ -65,6 +65,8 @@ it('repeats at eight-second start-to-start intervals only while empty, unfocused
vi.advanceTimersByTime(1)
expect(s.play).toHaveBeenCalledTimes(2)
s.update({ ...idle, focused: true })
+ expect(s.stop).toHaveBeenCalledTimes(1)
+ vi.advanceTimersByTime(TRACER_LAP_MS)
expect(s.stop).toHaveBeenCalledTimes(2)
vi.advanceTimersByTime(24000)
expect(s.play).toHaveBeenCalledTimes(2)
@@ -120,3 +122,23 @@ it('disposes timers on close and gets a fresh opening lap on reopen', () => {
expect(next.stop).toHaveBeenCalledTimes(1)
expect(vi.getTimerCount()).toBe(0)
})
+
+// Both the initial invitation and a later idle lap survive active editing.
+it.each([false, true])('finishes the original lap through typing, clearing, focus and hover without restarting (idle lap %s)', later => {
+ const s = setup()
+ vi.advanceTimersByTime(TRACER_DELAY_MS + (later ? 8000 : 0))
+ const plays = later ? 2 : 1, stops = later ? 1 : 0
+ vi.advanceTimersByTime(200)
+ s.update({ ...idle, focused: true, hovered: true, hasText: true })
+ vi.advanceTimersByTime(300)
+ s.update({ ...idle, focused: true })
+ s.update({ ...idle, focused: true, hasText: true })
+ vi.advanceTimersByTime(TRACER_LAP_MS - 501)
+ expect(s.stop).toHaveBeenCalledTimes(stops)
+ expect(s.play).toHaveBeenCalledTimes(plays)
+ vi.advanceTimersByTime(1)
+ expect(s.stop).toHaveBeenCalledTimes(stops + 1)
+ vi.advanceTimersByTime(24000)
+ expect(s.play).toHaveBeenCalledTimes(plays)
+ s.dispose()
+})
diff --git a/app/test/askTracerDom.test.ts b/app/test/askTracerDom.test.ts
index 01acb540..a4be7ee7 100644
--- a/app/test/askTracerDom.test.ts
+++ b/app/test/askTracerDom.test.ts
@@ -4,7 +4,7 @@ import { TRACER_DELAY_MS, TRACER_LAP_MS } from '../src/shared/askTracer'
afterEach(() => { vi.useRealTimers(); vi.unstubAllGlobals() })
-it('animates explicit dash offsets, follows the composer size, and cancels on native input and cleanup', () => {
+it('animates explicit dash offsets, follows the composer size, and finishes through native input and cleans up', () => {
vi.useFakeTimers()
const node = () => {
const element = {
@@ -43,7 +43,11 @@ it('animates explicit dash offsets, follows the composer size, and cancels on na
vi.advanceTimersByTime(TRACER_DELAY_MS)
for (let i = 0; i < 20; i++) expect(nodes[i + 1].animate).toHaveBeenCalledWith(
[{ strokeDashoffset: String(-i), easing: 'cubic-bezier(.37,0,.63,1)' }, { strokeDashoffset: String(-i - 100) }], { duration: TRACER_LAP_MS, easing: 'linear' })
- field.value = 'Draft'; box.dispatchEvent(new Event('input'))
+ vi.advanceTimersByTime(200)
+ field.value = 'Draft'; box.dispatchEvent(new Event('input')); tracer.update()
+ bounds = { width: 350, height: 190 }; resize()
+ for (const element of nodes) expect(element.animate.mock.results[0].value.cancel).not.toHaveBeenCalled()
+ vi.advanceTimersByTime(TRACER_LAP_MS - 200)
for (const element of nodes) expect(element.animate.mock.results[0].value.cancel).toHaveBeenCalledOnce()
vi.advanceTimersByTime(24000)
expect(nodes[0].animate).toHaveBeenCalledOnce()