Skip to content

fix(auth): clear front-end stores on login and logout instead of Clear-Site-Data - #4932

Merged
ildyria merged 3 commits into
masterfrom
clear-cache
Oct 29, 2026
Merged

ildyria merged 3 commits into
masterfrom
clear-cache

Conversation

@ildyria

@ildyria ildyria commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

fix(auth): clear front-end stores on login and logout instead of Clear-Site-Data

Summary by CodeRabbit

  • New Features

    • Login and logout now clear viewer-specific data, including timeline state and cached thumbnails.
    • Login options are available in the Tag and Timeline panels whenever you’re signed out.
  • Behavior Changes

    • Browser-cached asset responses are not cleared on login or logout. A thumbnail viewed earlier in the same browser may remain visible to a later viewer until its cache expires.

@ildyria
ildyria requested a review from a team as a code owner October 29, 2026 19:15
@coderabbitai

coderabbitai Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Walkthrough

Login and logout now clear client-side viewer state and caches. The server-side Clear-Site-Data mechanism is removed. Thumbnail object-URL cleanup is updated, and frontend context-menu and spotlight array expressions are simplified.

Changes: Viewer State Cleanup

Layer / File(s) Summary
Viewer cleanup contract and cache tradeoff
docs/specs/4-architecture/features/102-asset-endpoint-speedup/*, docs/specs/4-architecture/knowledge-map.md, docs/specs/4-architecture/roadmap.md
The feature records describe frontend state clearing on login and logout, while URL-keyed browser cache entries can remain available until expiration.
Thumbnail cache cleanup
resources/js/services/thumb-asset-service.ts, resources/js/services/thumb-asset-service.test.ts
ThumbAssetService.clear() clears cached entries. Object URLs and in-flight requests are handled according to active references; tests cover refetching, revocation, and request abort behavior.
Shared viewer reset and authentication wiring
resources/js/composables/useClearViewerState.ts, resources/js/composables/useClearViewerState.test.ts, resources/js/stores/TimelineState.ts, resources/js/v7/..., resources/js/v8/...
useClearViewerState resets viewer stores, timeline state, and caches. Login, WebAuthn, and logout call it. Timeline and Tag views show authentication modals when the user is not logged in.
Remove response-level cache clearing
app/Http/Kernel.php, app/Http/Middleware/ClearBrowserCache.php, app/Listeners/ClearBrowserCacheOnAuthChange.php, app/Providers/EventServiceProvider.php, tests/Feature_v2/AuthTest.php
The middleware and listener are removed from the request and event paths. Tests for the Clear-Site-Data response header are removed.

Frontend Expression and Typing Updates

Layer / File(s) Summary
Array expressions and component typings
resources/js/composables/contextMenus/contextMenu.ts, resources/js/v8/composables/contextMenus/contextMenu.ts, resources/js/v8/composables/spotlight/useSpotlightRemoteSearch.ts, resources/js/components.d.ts
Context-menu arrays are passed directly to push, and spotlight search returns its mapped photos directly. Vue global typings now include RouterLink and RouterView.

Priority: Normal

Estimated code review effort: 3 (Moderate) | ~25 minutes

Merge Risk: Moderate · up to 754eb

Viewer changes can leave stale search or timeline results visible, and pending requests can restore earlier viewer data. Resolve those state transitions before merging; the documentation discrepancies also remain.

Pre-merge checks: Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 71.43% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Full details: Docstring Coverage

Explanation

Docstring coverage is 71.43% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 7 functions across 10 files. (9 skipped: 9 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

A rabbit checks the cache at dawn,
Then clears the state when guests move on.
A thumbnail waits until release,
While menus hop with simpler ease.
The bunny thumps: the changes are done!

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 5


Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 860530a0-7d18-4658-9f02-a38b85420889
Commits

Reviewing files that changed from the base of the PR and between 9567e11 and ffc16b5.

Files selected for processing: 22
  • app/Http/Kernel.php
  • app/Http/Middleware/ClearBrowserCache.php
  • app/Listeners/ClearBrowserCacheOnAuthChange.php
  • app/Providers/EventServiceProvider.php
  • docs/specs/4-architecture/features/102-asset-endpoint-speedup/open-questions.md
  • docs/specs/4-architecture/features/102-asset-endpoint-speedup/plan.md
  • docs/specs/4-architecture/features/102-asset-endpoint-speedup/spec.md
  • docs/specs/4-architecture/features/102-asset-endpoint-speedup/tasks.md
  • docs/specs/4-architecture/knowledge-map.md
  • docs/specs/4-architecture/roadmap.md
  • resources/js/components.d.ts
  • resources/js/composables/useClearViewerState.test.ts
  • resources/js/composables/useClearViewerState.ts
  • resources/js/services/thumb-asset-service.test.ts
  • resources/js/services/thumb-asset-service.ts
  • resources/js/v7/components/forms/auth/LoginForm.vue
  • resources/js/v7/components/modals/WebauthnModal.vue
  • resources/js/v7/menus/LeftMenu.vue
  • resources/js/v8/components/forms/auth/LoginForm.vue
  • resources/js/v8/components/modals/WebauthnModal.vue
  • resources/js/v8/composables/useLogout.ts
  • tests/Feature_v2/AuthTest.php
Files with no reviewable changes: 5
  • app/Http/Kernel.php
  • app/Http/Middleware/ClearBrowserCache.php
  • app/Providers/EventServiceProvider.php
  • tests/Feature_v2/AuthTest.php
  • app/Listeners/ClearBrowserCacheOnAuthChange.php

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

Comment thread docs/specs/4-architecture/roadmap.md Resolved

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1


Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5b3781bd-3fcd-429c-89b5-be9d754b77cb
Commits

Reviewing files that changed from the base of the PR and between ffc16b5 and 7d148bb.

Files selected for processing: 6
  • resources/js/components.d.ts
  • resources/js/composables/contextMenus/contextMenu.ts
  • resources/js/v7/components/forms/album/EmbedCodeDialog.vue
  • resources/js/v8/components/forms/album/EmbedCodeDialog.vue
  • resources/js/v8/composables/contextMenus/contextMenu.ts
  • resources/js/v8/composables/spotlight/useSpotlightRemoteSearch.ts
Files skipped from review as they are similar to previous changes: 1
  • resources/js/components.d.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)

Minor · Reset SearchState during login cleanup. · useClearViewerState.ts:33-44

resources/js/composables/useClearViewerState.ts:33-44
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Reset SearchState during login cleanup.

After a guest searches in the v8 search view, successful login calls clearViewerState() but leaves SearchState.albumTilesV3 and searchTerm unchanged. The search view renders those cached album tiles directly, so the new viewer can see results and rights-derived actions from the previous viewer without a new request.

Suggested fix
 import { useTimelineStore } from "@/stores/TimelineState";
+import { useSearchStore } from "@/stores/SearchState";

 export function useClearViewerState() {
 	// existing store declarations
+	const searchStore = useSearchStore();

 	function clearViewerState(): void {
 		globalRightsStore.reset();
 		photoStore.reset();
 		photosStore.reset();
 		albumsStore.reset();
 		albumStore.reset();
 		timelineStore.reset();
+		searchStore.reset();
 		userStore.setUser(undefined);
🔇 Additional comments: 1
docs/specs/4-architecture/knowledge-map.md-196-196: 1

196-196: Minor · Maintainability & Code Quality · Quick win

⚠️ Unverified finding
Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.

Clarify the ThumbAssetService cleanup behavior.

The parenthetical is grammatically incomplete. State that clear() revokes URLs with no active holders, while a URL still rendered is revoked after its final release(). This matches the implementation and FR-102-08. (github.com)


Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c710ec70-6a6c-4412-8bf1-bfee4cd251fd
Commits

Reviewing files that changed from the base of the PR and between 7d148bb and 754ebcf.

Files selected for processing: 12
  • docs/specs/4-architecture/features/102-asset-endpoint-speedup/plan.md
  • docs/specs/4-architecture/features/102-asset-endpoint-speedup/spec.md
  • docs/specs/4-architecture/features/102-asset-endpoint-speedup/tasks.md
  • docs/specs/4-architecture/knowledge-map.md
  • docs/specs/4-architecture/roadmap.md
  • resources/js/composables/useClearViewerState.test.ts
  • resources/js/composables/useClearViewerState.ts
  • resources/js/stores/TimelineState.ts
  • resources/js/v7/views/gallery-panels/Tag.vue
  • resources/js/v7/views/gallery-panels/Timeline.vue
  • resources/js/v8/views/gallery-panels/Tag.vue
  • resources/js/v8/views/gallery-panels/Timeline.vue
Files skipped from review as they are similar to previous changes: 2
  • docs/specs/4-architecture/roadmap.md
  • docs/specs/4-architecture/features/102-asset-endpoint-speedup/tasks.md

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.

Comment thread resources/js/stores/TimelineState.ts Resolved
Comment thread resources/js/stores/TimelineState.ts Resolved
@codecov

codecov Bot commented Oct 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.32%. Comparing base (9567e11) to head (754ebcf).

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ildyria
ildyria merged commit 4e5d5c8 into master Oct 29, 2026
57 checks passed
@ildyria
ildyria deleted the clear-cache branch October 29, 2026 22:53
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.

1 participant