Skip to content

feat: add api detail cache system#6

Merged
nonhana merged 13 commits into
mainfrom
dev
Apr 19, 2026
Merged

feat: add api detail cache system#6
nonhana merged 13 commits into
mainfrom
dev

Conversation

@nonhana

@nonhana nonhana commented Apr 19, 2026

Copy link
Copy Markdown
Owner
  • Api item details will be reused
  • Fixed some UI issues

nonhana added 13 commits April 19, 2026 00:23
Team worktree integration accidentally staged node_modules symlinks from worker checkpoints. Remove those repository entries so dependency directories remain ignored runtime artifacts rather than tracked source files.\n\nConstraint: node_modules/ is already ignored and must not be versioned\nRejected: Keep worktree symlinks in git | creates self-referential dependency paths in the leader checkout\nConfidence: high\nScope-risk: narrow\nTested: pnpm install --frozen-lockfile restored local dependencies\nNot-tested: none
Mutation handlers now clear the affected Workbench read-resource entries immediately after API saves, version state changes, and API deletion so later cached reads do not serve stale details, version lists, version details, or comparisons.

Constraint: Invalidation must work with the new memory-only resource cache and without changing API contracts

Rejected: Rely on follow-up refresh calls alone | cached get calls could return stale data after worker-2 wires components through the resource store

Confidence: high

Scope-risk: narrow

Tested: lsp_diagnostics useApiEditorStore.ts, useApiTreeStore.ts, VersionHistory.vue

Tested: pnpm --filter @apiplayer/frontend lint

Tested: pnpm --filter @apiplayer/frontend build
The quick version panel used the same version list endpoint as the full History view, so leaving it on direct API access would preserve another duplicate-request path if the panel is mounted later. Reuse the Workbench resource store so all version-list consumers share in-flight dedupe and invalidation.\n\nConstraint: No new dependencies; keep caching centralized in the new Pinia store\nRejected: Leave unused component untouched | future use would reintroduce the repeated History-list request path\nConfidence: high\nScope-risk: narrow\nTested: Not yet; pending full frontend lint/build after team completion\nNot-tested: Browser network panel manual flow
Publishing a version can change more than the target version's status, and the quick panel shares the same version-list resource as History. Broaden publish invalidation to the API's version-detail cache, guard quick-panel async writes by resource key, and expose currentVersionId from API detail so current-version UI state is backed by the response contract.

Constraint: No new dependencies; keep read caching centralized in useWorkbenchResourceStore

Rejected: Invalidate only the published version detail | the previous current version is archived during publish and could otherwise retain stale detail status

Confidence: high

Scope-risk: narrow

Tested: pnpm --filter @apiplayer/frontend lint

Tested: pnpm --filter @apiplayer/frontend build

Tested: pnpm --filter @apiplayer/backend lint

Tested: pnpm --filter @apiplayer/backend typecheck

Tested: pnpm --filter @apiplayer/backend build

Tested: lsp_diagnostics VersionHistory.vue, VersionQuickPanel.vue, api.dto.ts

Not-tested: Browser DevTools Network manual switching scenarios
Copilot AI review requested due to automatic review settings April 19, 2026 04:43
@netlify

netlify Bot commented Apr 19, 2026

Copy link
Copy Markdown

Deploy Preview for apiplayer ready!

Name Link
🔨 Latest commit a97d9c6
🔍 Latest deploy log https://app.netlify.com/projects/apiplayer/deploys/69e45d83d3d1f0000869ba08
😎 Deploy Preview https://deploy-preview-6--apiplayer.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@nonhana nonhana merged commit 16d1cf7 into main Apr 19, 2026
10 of 11 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds a frontend “workbench resource” caching layer so API details / version resources can be reused across workbench views, and aligns the backend API detail DTO with the frontend’s currentVersionId usage.

Changes:

  • Introduced a Pinia-based resource cache with de-duplication/invalidation helpers for API detail and version resources.
  • Updated workbench UI components/stores to fetch via the cache and invalidate/reset cached data on mutations and project switches.
  • Exposed currentVersionId in the backend ApiDetailDto and applied a couple of small UI tweaks (.gitignore, tooltip placement, layout widths).

Reviewed changes

Copilot reviewed 11 out of 12 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
apps/frontend/src/stores/useWorkbenchResourceStore.ts New centralized cache/inflight coordination + invalidation API for workbench resources
apps/frontend/src/stores/useApiTreeStore.ts Invalidate cached API resources after deleting an API
apps/frontend/src/stores/useApiEditorStore.ts Invalidate cached API resources after updating an API; minor safety refactor using captured apiId
apps/frontend/src/layouts/WorkbenchLayout.vue Reset workbench cache on project change and on unmount
apps/frontend/src/components/workbench/version/VersionQuickPanel.vue Use cached version list and add request-key guards for async races
apps/frontend/src/components/workbench/version/VersionHistory.vue Use cached version list, add force-refresh support, and invalidate caches on publish/archive/rollback
apps/frontend/src/components/workbench/version/VersionDetailSheet.vue Fetch version detail via cache and add async race guards
apps/frontend/src/components/workbench/version/VersionCompareSheet.vue Fetch comparison via cache and add async race guards
apps/frontend/src/components/workbench/api-editor/ApiEditor.vue Fetch API detail via cache, add force refresh, and adjust tab content layout widths
apps/frontend/src/components/workbench/WorkbenchSidebar.vue Tooltip placement tweak
apps/backend/src/api/dto/api.dto.ts Add currentVersionId to ApiDetailDto response
.gitignore Ignore .omx/ directory

Comment on lines +110 to +112
if (!options.force) {
bucket.inflight.set(key, request)
}

Copilot AI Apr 19, 2026

Copy link

Choose a reason for hiding this comment

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

getResource starts a new request when options.force is true, but it does not update/replace bucket.inflight. If a previous non-force request is still in-flight, subsequent non-force callers will keep receiving the older in-flight promise (stale result) instead of the forced refresh. Consider replacing any existing inflight entry when forcing (or always storing the latest request in inflight) so all callers can await the most recent fetch and avoid serving stale data during a refresh.

Suggested change
if (!options.force) {
bucket.inflight.set(key, request)
}
bucket.inflight.set(key, request)

Copilot uses AI. Check for mistakes.
@nonhana nonhana deleted the dev branch May 30, 2026 09:34
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.

2 participants