Skip to content

Touch board when publication changes to bust JSON cache#2674

Merged
flavorjones merged 1 commit into
basecamp:mainfrom
robzolkos:touch-board-on-publication-change
Mar 9, 2026
Merged

Touch board when publication changes to bust JSON cache#2674
flavorjones merged 1 commit into
basecamp:mainfrom
robzolkos:touch-board-on-publication-change

Conversation

@robzolkos

Copy link
Copy Markdown
Collaborator

Summary

  • Publishing or unpublishing a board via JSON didn't update public_url in subsequent GET /boards/:id.json responses
  • The board partial uses json.cache! board which keys off board.updated_at, but creating/destroying a Board::Publication never touched the parent board
  • Adding touch: true to the belongs_to :board association bumps the board's timestamp on publish/unpublish, busting the stale cache

Fixes the missing public_url field observed on hosted after #2663.

Copilot AI review requested due to automatic review settings March 7, 2026 20:28

Copilot AI 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.

Pull request overview

This PR ensures board JSON responses don’t serve stale cached data after publishing/unpublishing by updating the board’s timestamp whenever a Board::Publication is created or destroyed.

Changes:

  • Add touch: true to Board::Publication’s belongs_to :board so board.updated_at changes on publish/unpublish.
  • Ensures json.cache! board in the board JSON partial is re-keyed after publication state changes, allowing public_url to appear/disappear correctly.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread app/models/board/publication.rb
Publishing or unpublishing a board didn't bust the `json.cache! board`
fragment cache because `Board::Publication` didn't touch its parent
board. The board's `updated_at` stayed stale, so subsequent GET requests
continued serving cached JSON without `public_url`.
@robzolkos robzolkos force-pushed the touch-board-on-publication-change branch from 5dc819b to 6e071b7 Compare March 7, 2026 20:41

@flavorjones flavorjones left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM!

@flavorjones flavorjones merged commit a896b0a into basecamp:main Mar 9, 2026
5 checks passed
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.

3 participants