fix(watchlist): normalize notion_url null-sentinel in buildRecord prev-read

quotedOrNull renders an empty notion_url as the literal string `null`.
buildRecord read that back verbatim on the next sync pass and re-quoted
it as "null", breaking diff-on-write (every re-sync of a note with no
notion_url appeared changed). Treat the `null` sentinel as empty when
reading prev frontmatter.
This commit is contained in:
afiqzudinhadi 2026-07-30 12:30:57 +08:00
parent 79ba40f04d
commit 1923bb87b8

View file

@ -139,7 +139,8 @@ export function buildRecord(details: TmdbDetail, isMovie: boolean, prev: Record<
let watchStatus = prev['watch_status'] || 'Unwatched';
const rating = prev['rating'] || '0';
const ratingStars = prev['rating_stars'] ?? '';
const notionUrl = prev['notion_url'] || '';
const rawNotionUrl = prev['notion_url'] || '';
const notionUrl = rawNotionUrl === 'null' ? '' : rawNotionUrl; // quotedOrNull renders empty as literal `null` — don't round-trip it as a value
// ---- TV watch-status rule: new episode aired since last sync ----
const prevLast = (prev['last_air_date'] ?? '').trim().replace(/^"|"$/g, '');