import type { PriceState } from "@/interfaces"; /** * Returns true when we should append a new row to price_history for `next`. * * - `next == null` means "price could not be observed this run" — not a change. * - `prev == null` (no history yet) and `next != null` is the first observation. */ export const isPriceChange = (prev: PriceState | null, next: PriceState | null): boolean => { if (next === null) return false; if (prev === null) return true; return prev.priceYen !== next.priceYen || prev.onPromo !== next.onPromo; };