mirror of
https://github.com/jason5ng32/MyIP.git
synced 2026-11-04 08:55:47 +00:00
App.vue wraps the router view in a KeepAlive holding Home and the tool page, so leaving for /tools/:slug and coming back neither re-runs the homepage tests nor loses the scroll position; ToolPage (StandaloneTool renamed) reads its slug reactively — the same instance now switches tool on in-app navigation — and caches each visited tool per slug in its own KeepAlive (max 8), dropping them all when the signed-in account goes away (utils/tool-cache.js). Cached pages pause while hidden: composables/use-route-active.js gives useRouteActive / useActiveValue / useActiveEventListener, and the head writer, the shortcut map, the scroll trackers, the ?q= watchers of ASN Profile and IP Calculator, the User dialog triggers and the overlay counter all act only for the page on screen. An overlay still open when its page is left closes, as its portal lives outside the cached page. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013GbLTGMZ45MV78qd2tHoco
30 lines
1.0 KiB
JavaScript
30 lines
1.0 KiB
JavaScript
// shouldDropToolCache() — when ToolPage drops every cached tool (the auth
|
|
// epoch): the signed-in account went away, never on a first sign-in.
|
|
|
|
import assert from 'node:assert/strict';
|
|
import { describe, it } from 'node:test';
|
|
import { shouldDropToolCache } from '../frontend/utils/tool-cache.js';
|
|
|
|
describe('shouldDropToolCache()', () => {
|
|
it('drops on sign-out', () => {
|
|
assert.equal(shouldDropToolCache('uid-a', null), true);
|
|
});
|
|
|
|
it('drops on an account switch', () => {
|
|
assert.equal(shouldDropToolCache('uid-a', 'uid-b'), true);
|
|
});
|
|
|
|
it('keeps the cache on a first sign-in', () => {
|
|
assert.equal(shouldDropToolCache(null, 'uid-a'), false);
|
|
assert.equal(shouldDropToolCache(undefined, 'uid-a'), false);
|
|
});
|
|
|
|
it('keeps the cache while the same account stays signed in (token refresh)', () => {
|
|
assert.equal(shouldDropToolCache('uid-a', 'uid-a'), false);
|
|
});
|
|
|
|
it('keeps the cache while nobody is signed in', () => {
|
|
assert.equal(shouldDropToolCache(null, null), false);
|
|
});
|
|
});
|