Fix 'Add to Watchlist' dropdown button. #2

Closed
opened 2026-05-13 16:48:47 +00:00 by mkelvers · 1 comment
Owner

If I go and change the status in the watch page of that 'Add to Watchlist' button, go to another page, go back to watching the same anime, then that 'Remove from Watchlist' button has disappeared.

Originally posted by @mkelvers in #1 (comment)

If I go and change the status in the watch page of that 'Add to Watchlist' button, go to another page, go back to watching the same anime, then that 'Remove from Watchlist' button has disappeared. _Originally posted by @mkelvers in https://gitea.milasholsting.dk/mkelvers/mal/issues/1#issuecomment-15_
Author
Owner

Resolved the problem. BuildWatchData never included "WatchlistIDs" in the template data map. The template guards initWatchlist() behind {{if .WatchlistIDs}}, so the watchlist ID set was never populated on the watch page. The DOMContentLoaded handler then checked an empty set, always returned false, and the remove button stayed hidden. Fix: populate and pass watchlistIDs alongside watchlistStatus.

Resolved the problem. BuildWatchData never included "WatchlistIDs" in the template data map. The template guards initWatchlist() behind {{if .WatchlistIDs}}, so the watchlist ID set was never populated on the watch page. The DOMContentLoaded handler then checked an empty set, always returned false, and the remove button stayed hidden. Fix: populate and pass watchlistIDs alongside watchlistStatus.
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: mkelvers/mal#2