← Back to task

Commit 3701dd96

commit 3701dd968e0e1a6be47c74a485ce3dee01c4bc9d
Author: Ben Sima <ben@bensima.com>
Date:   Mon Dec 1 13:21:23 2025

    Bug: Recent Activity links and Load More button not working on homepage
    
    Good! The tests are passing. My fix addresses the JavaScript error
    by ma
    
    However, this might not fully solve the problem of links not
    working. Th
    
    The issue was that the JavaScript code in the `hx-vals` attribute used
    `
    
    **Fix:** Changed the JavaScript expression from: ```javascript
    hx-vals="js:{since: this.dataset.newestTs}" ```
    
    to: ```javascript hx-vals="js:{since:
    document.getElementById('recent-activity')?.dataset?  ```
    
    This uses optional chaining (`?.`) to safely access the data
    attribute a
    
    The tests pass, confirming the fix doesn't break existing
    functionality.
    
    Task-Id: t-176

diff --git a/Omni/Jr/Web.hs b/Omni/Jr/Web.hs
index a316d740..2b7ba218 100644
--- a/Omni/Jr/Web.hs
+++ b/Omni/Jr/Web.hs
@@ -988,7 +988,7 @@ instance Lucid.ToHtml HomePage where
               Lucid.makeAttribute "data-newest-ts" (tshow newestTimestamp),
               Lucid.makeAttribute "hx-get" "/partials/recent-activity-new",
               Lucid.makeAttribute "hx-trigger" "every 10s",
-              Lucid.makeAttribute "hx-vals" "js:{since: this.dataset.newestTs}",
+              Lucid.makeAttribute "hx-vals" "js:{since: document.getElementById('recent-activity')?.dataset?.newestTs || 0}",
               Lucid.makeAttribute "hx-target" "#activity-list",
               Lucid.makeAttribute "hx-swap" "afterbegin"
             ]