Pre demo polishment#255
Conversation
… issues feat(my-wordpress): support multiple instances and ensure correct state handling fix(ui): optimize canvas context for frequent read operations test: add regression tests for dock-peek and multi-instance My WordPress behavior
|
@claude this is a PR that mostly fix small bugs, and also adds updates to the activity footprint. Can you review it? |
|
Claude finished @AllTerrainDeveloper's task in 2m 25s —— View job PR Review: Pre Demo Polishment
SummaryThis is a solid polish PR. The three independent bug fixes are well-scoped and each has a clear reproduction story. The user-footprint feature extension is coherent and well-integrated. Tests are targeted and cover the exact regression scenarios described. A few issues worth flagging below. 1. Backward-compatibility gap in
|
✅ WordPress Plugin Check Report
📊 ReportAll checks passed! No errors or warnings found. 🤖 Generated by WordPress Plugin Check Action • Learn more about Plugin Check |
…st-update entries
|
@claude I'm testing you, can you even fill the PR description based on the changes in the commits? |
|
Claude finished @AllTerrainDeveloper's task in 1m 38s —— View job PR Description (generated from commits)Here's a PR description you can paste into the PR body: Pre-Demo PolishmentA set of targeted bug fixes and a feature extension to the user activity footprint. No architectural changes; each fix is self-contained and regression-tested. FixesDock-peek: native-window icons now open correctly (
|
A set of targeted bug fixes and a feature extension to the user activity footprint. No architectural changes; each fix is self-contained and regression-tested.
Fixes
Dock-peek: native-window icons now open correctly (
src/dock.ts)Dock items whose target is a native window (My WordPress, Jorvy, plugin-registered launchers) carry a
windowIdbut nourl. Clicking them in dock-peek was falling through to the generic URL-based iframe path, which opened a chrome-only window withsrc=""— the user saw a title bar with no content.The fix adds an early guard: if
item.windowId && !item.url, the click is routed directly throughwp.desktop.openNewWindow(), spawning a proper native instance. IfopenNewWindowreturns falsy (old API, feature flag off) the existing fallback logic handles it transparently.My WordPress: multiple instances no longer interfere with each other (
src/my-wordpress/index.ts)Three related issues when two My WordPress windows were open at the same time:
Close clobbered live siblings. The previous teardown used a
desktop-mode-window-closeddocument listener matched on the baseWINDOW_ID. Every sibling's close event fired the same handler — closing instance B cleared instance A's state and left it broken. Fixed by havingrenderIntoreturn a per-instance teardown that the framework calls only for that specific window.Navigation in a non-foreground instance threw.
asRenderStatecompared against the singletonactiveState. Drilling into a posts list inside a backgrounded duplicate triggered "host body does not match active state". Fixed by introducing aliveStates: Map<HTMLElement, RenderState>that letsasRenderStateresolve the correct state for any live instance.Drag-rejection drop targets overwrote each other. Both instances registered a claimant with the same id (
my-wordpress-reject), so the second registration silently replaced the first's element binding. Fixed by appending a per-mount monotonic counter (rejectIdCounter) to the id.UI:
willReadFrequently: trueon pixel-readback canvas contexts (src/ui/components/wpd-crumb-chain/wpd-crumb-chain.ts,src/ui/util/avatar-resolve.ts)Both
wpd-crumb-chain(foreground-color picker) andavatar-resolve(transparent-pixel probe) create a 1×1 canvas and immediately callgetImageData. Without thewillReadFrequentlyhint Chrome backs the canvas with a GPU texture, so eachgetImageDatatriggers a GPU→CPU sync. The breadcrumb chain re-paints on every navigation; the avatar resolver fires once per unique URL across the page — often enough that Chrome was surfacing the "willReadFrequently" performance warning in both cases.Feature: User activity footprint now tracks post updates / revisions
includes/my-wordpress/user-footprint.php·src/my-wordpress/index.ts·src/my-wordpress/types.tsThe activity heatmap and stats previously only counted published posts and comments. Editors who spend most of their time updating existing content (the typical CMS workflow) appeared to have no activity. This brings the footprint model in line with how GitHub counts contributions — edits to existing content are first-class activity.
What counts as an "update": a WordPress revision saved by the user after the parent post's initial creation (
r.post_date_gmt > p.post_date_gmt). The initial save is excluded so it doesn't double-count with the "posts" column. Updates are attributed to whoever hit Save (viar.post_author), not the post owner — consistent with tracking editorial work across a team.Changes in detail:
daily[].updates— per-day update count, added alongside the existingpostsandcommentsfields (zero-filled for days with no saves).totals.updates— lifetime revision count, excluding the initial save.timelinepost-updatekind — revisions are collapsed per parent post (GROUP BY r.post_parent, MAX(post_date_gmt)) so a burst of saves on one article reads as a single row rather than flooding the timeline. Displayed with a pencil icon and "Updated"…"" label.timeline[].type— CPT slug ('post','page', custom type) added topostandpost-updaterows so the renderer can pick a Post-vs-Page icon without a second REST lookup.posts + comments + updates.Tests
tests/vitest/dock-peek-native-icon-spawn.test.ts— verifies that awindowId-only dock item spawns a native window and does not fall through to the iframe path.tests/vitest/my-wordpress-multi-instance.test.ts— covers the three multi-instance regressions above: close isolation, independent navigation, and unique drop-target ids.