Opened 4 months ago
Last modified 6 weeks ago
#65461 accepted defect (bug)
Posts in list table are not kept up to date when changes are made in other windows
| Reported by: | westonruter | Owned by: | westonruter |
|---|---|---|---|
| Priority: | normal | Milestone: | Future Release |
| Component: | Posts, Post Types | Version: | |
| Severity: | normal | Keywords: | has-patch has-unit-tests |
| Cc: | Focuses: | administration |
Description (last modified by )
There are multiple scenarios where the posts listed on the posts screen (the post list table) can become out of date and show stale content (e.g. the old post title). For example:
- From the post list table, clicking to edit the post in a new tab. If a change is made to the title, the old title will appear in the list when the edit post screen tab is closed.
- Clicking to edit a post from the post list table, and then in the edit post screen changing the title and saving, followed by hitting the back button when the Instant Back/Forward plugin is active. The old post title is shown due to the edit posts screen being restored from bfcache. Related GitHub issue.
- Opening the Posts window with the WP Desktop Mode plugin active, if you click to edit a post it will open in another window shown at the same time in the desktop view. Edits to the post do not get reflected in the Posts window.
I understand that data views will be able to solve for this more elegantly when they are eventually implemented here, but in the meantime I think we can handle this by listening for updates to the posts and then triggering the admin ajax update that happens after a quick edit to re-render the row.
Additional implementation ideas include using the storage event to trigger an update when a user edits a post in another window, as well as to use heartbeat to broadcast updates to posts since a given timestamp when the posts screen was first loaded.
Special handling will be needed for post creation (e.g. an admin notice to trigger a page reload), and post deletions (e.g. to show the post row in red in a deleted state).
Related: #63636
Attachments (1)
Change History (8)
#2
@
4 months ago
- Milestone Awaiting Review → 7.1
Milestoning for 7.1 as this is closely related to real-time collaboration (RTC)
#6
@
3 months ago
I was able to reproduce this issue as described.
I tested by opening the Posts list in one tab and editing a post in another tab. After updating the post title and returning to the Posts list, the list continued to display the stale title until the page was manually refreshed.
This confirms that the post list table is not updated automatically when changes are made in another tab/window, resulting in outdated information being shown.
This ticket was mentioned in PR #13275 on WordPress/wordpress-develop by @sukhendu2002.
6 weeks ago
#7
- Keywords has-patch has-unit-tests added
## What this PR does
Fixes stale post list-table rows when a post is changed in another browser window or after restoring the list through browser history.
Trac ticket: https://core.trac.wordpress.org/ticket/65461
## Manual testing
Use two browser windows logged into the same WordPress installation.
### External post update
- In window A, open Posts → All Posts and note a post title.
- In window B, edit that post, change its title, and save.
- Return to window A and wait up to 10 seconds for Heartbeat.
- Confirm that the list reloads and displays the updated title.
### Quick Edit preservation
- In window A, open Quick Edit for a post.
- Change the title but do not click Update.
- In window B, edit and save the same post.
- Return to window A and trigger Heartbeat or wait up to 10 seconds.
- Confirm that the page does not reload and the unsaved Quick Edit title remains.
- Click Cancel in Quick Edit.
- Trigger Heartbeat again.
- Confirm that the list reloads and displays the title saved in window B.
### Filter membership
- Create a draft post.
- In window A, open Posts → All Posts and select the Published filter.
- In window B, publish the draft.
- Return to window A and trigger Heartbeat.
- Confirm that the list reloads and the newly published post appears.
### Creation and deletion
- Keep Posts → All Posts open in window A.
- Create and publish a post in window B.
- Trigger Heartbeat in window A and confirm that the new post appears.
- Trash the post in window B.
- Trigger Heartbeat again and confirm that the row disappears.
## Use of AI Tools
AI assistance: Yes
Tool(s): pi coding agent
Model(s): GPT-5.6
Used for: Initial code skeleton, code review, test suggestion and PR description drafting; final implementation and tests were reviewed and edited by me.
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Issue demonstration in WP Desktop Mode