Skip to content

fix: drop stale journal refs when clearing datetime values - #13417

Merged
tiensonqin merged 1 commit into
masterfrom
logseq/fix-cleared-date-journal-refs-a5a2
Sep 24, 2026
Merged

tiensonqin merged 1 commit into
masterfrom
logseq/fix-cleared-date-journal-refs-a5a2

Conversation

@tiensonqin

@tiensonqin tiensonqin commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Fixes logseq/db-test#1282

Clearing a datetime property (Deadline, Scheduled, or a user datetime) to :logseq.property/empty-placeholder kept the property on the node, but past journal pages still appeared in Linked References. Today's date looked fine because the task already lives on today's journal; Datascript still kept a stale :block/refs entry for past days.

get-journal-day-from-long treated the empty-placeholder keyword as a timestamp. ms->journal-day returned nil, and (d/datoms db :avet :block/journal-day nil) then resolved to an existing journal page — typically the earliest past journal.

This change only resolves journal refs from numeric millisecond values, so a cleared datetime no longer keeps or re-adds a journal ref.

Tests

  • Set a past Deadline, clear to empty-placeholder, assert the journal is gone from rebuilt :block/refs (including the bulk rebuild path)
  • Worker pipeline: past Deadline clear removes the linked ref; today's Deadline clear still works; remove-block-property! still clears refs
  • Existing date/datetime empty-placeholder persistence tests still pass
Open in Web Open in Cursor 

Devin Review

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

Clearing Deadline/Scheduled to empty-placeholder left past journal
pages in :block/refs because get-journal-day-from-long treated the
placeholder as a timestamp and looked up a nil journal-day.

Fixes logseq/db-test#1282

Co-authored-by: Tienson Qin <[email protected]>
@tiensonqin
tiensonqin force-pushed the logseq/fix-cleared-date-journal-refs-a5a2 branch from 3e0b519 to 5247c23 Compare September 24, 2026 16:42
@tiensonqin
tiensonqin merged commit fdde467 into master Sep 24, 2026
11 of 14 checks passed
@tiensonqin
tiensonqin deleted the logseq/fix-cleared-date-journal-refs-a5a2 branch September 24, 2026 16:42
devin-ai-integration Bot pushed a commit that referenced this pull request Oct 1, 2026
Clearing Deadline/Scheduled to empty-placeholder left past journal
pages in :block/refs because get-journal-day-from-long treated the
placeholder as a timestamp and looked up a nil journal-day.

Fixes logseq/db-test#1282

Co-authored-by: Cursor Agent <[email protected]>
devin-ai-integration Bot pushed a commit that referenced this pull request Oct 8, 2026
Clearing Deadline/Scheduled to empty-placeholder left past journal
pages in :block/refs because get-journal-day-from-long treated the
placeholder as a timestamp and looked up a nil journal-day.

Fixes logseq/db-test#1282

Co-authored-by: Cursor Agent <[email protected]>
devin-ai-integration Bot pushed a commit that referenced this pull request Oct 8, 2026
Clearing Deadline/Scheduled to empty-placeholder left past journal
pages in :block/refs because get-journal-day-from-long treated the
placeholder as a timestamp and looked up a nil journal-day.

Fixes logseq/db-test#1282

Co-authored-by: Cursor Agent <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cleared date property values still appear as linked references for past dates

2 participants