Rest API/Gutenberg: Alert when an admin screen goes stale due to another user's save#77
Open
Intenzi wants to merge 7 commits into
Open
Rest API/Gutenberg: Alert when an admin screen goes stale due to another user's save#77Intenzi wants to merge 7 commits into
Intenzi wants to merge 7 commits into
Conversation
- Expose restUrl and nonce configurations in PHP for stale screen scripts - Add window.wp.presence.markScreenStale method to trigger background stale bumps
Contributor
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Contributor
▶ Preview in WordPress PlaygroundBoots a fresh WordPress with this PR's presence-api build, seeds 5 demo users, and drops you on the dashboard. Stress-test variant: 40 demo users · Built from |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes: #28
Follow-up to: #22
How?
This PR implements the stale-screen detection enhancements by introducing a new client-side API and a supporting REST route to handle non-redirecting, JS-driven saves:
Server-Side Changes
wp_presence_screen_heartbeat_received()into a new shared helper function:wp_presence_current_user_can_access_screen()./wp-presence/v1/presence/screen-revisions/staletoWP_REST_Presence_Controller.wp_presence_bump_screen_revision()to increment the revision.wp_presence_enqueue_stale_screen_banner()to pass down therestUrland thenonceto the client.Client-Side Changes
wp.presence.markScreenStale(): Added this new global method on thewindow.wp.presencenamespace.POSTrequest to the new REST endpoint.Additionally added unit tests for the bump wrapper methods success, failure and updated README with info on Stale Screen Detection.
Demo Video
8mb.video-Stale.Screen.Detection.API.mp4
Use of AI Tools
AI assistance: Yes
Tool(s): Antigravity IDE
Model(s): Gemini 3.1 Pro (Low)
Used for: Identifying relevant code files, deciding on implementation and architecture for enhancement. Unit tests were implemented via it. Final implementation and tests were reviewed and edited by me.