Page update notification and reload
- Dominant language
- Elixir
- Stars
- 1.3k
- Forks
- 134
- PR merge metrics
- No merged PRs in 30d
Description
Make updating pages' layout optional. Currently, publishing a page will reload the resources associated with that page (templates, css, and so on):
https://github.com/BeaconCMS/beacon/blob/02f982e360db5249802b8ee6121a195699affb65/lib/beacon/pages.ex#L141
which will eventually broadcast a `page_updated` event:
https://github.com/BeaconCMS/beacon/blob/02f982e360db5249802b8ee6121a195699affb65/lib/beacon/loader.ex#L118
that's captured by the page live view to update its own state
https://github.com/BeaconCMS/beacon/blob/7790eb72769a026c0bdfc3167aab394a9b73ce91/lib/beacon_web/live/page_live.ex#L39
That LiveView is responsible for displaying pages and updating title, meta tags, and style. The problem is current visitors of that page will get a reloaded page while still reading that page, which is not desirable UX-wise. For that reason reloading a page in-place is disabled for now (the commented code).
But we want to make the last step optional (updating its own state) by displaying a "Updates Available" notification/button to current visitors of the page and giving the option to update if they want to. Clicking on this button will refresh the page.
We also want to add an option on /admin to allow forcing such update on pages when publishing pages, in this case it would display a notification "This page has been updated".
Contributor guide
Research direction
Start with the linked publishing flow in lib/beacon/pages.ex, the page_updated event in lib/beacon/loader.ex, and the visitor handling in lib/beacon_web/live/page_live.ex; then inspect the /admin publishing options. Done means visitors can choose when to refresh after an update, while administrators can force an update notification when publishing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- elixir
- Domain
- frontend, web-dev
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100