mirror of
https://github.com/Komediruzecki/token-circles.git
synced 2026-10-20 09:46:43 +02:00
Three demo/UX fixes, each reproduced and re-verified in real browsers (Chromium +
Firefox, Playwright) under deployed-build conditions.
1. Profile selector (long-standing): switching the active profile made a profile
vanish from the dropdown. Reproduced deterministically: select High -> reopen ->
Mid gone ("1 of 2 selected"). Root cause: setCurrentProfile stored the SAME object
instance that lived in the profiles array (aliasing), and Solid's setState shallow-
MERGES object values — so the next switch merged the new profile's fields straight
into the old aliased array entry, turning it into a duplicate that the dropdown's
defensive dedup then dropped. The store setter now forces replace semantics (null
first) and keeps its own shallow copy so no store path ever aliases another.
Red/green regression tests added; browser torture-test (5 consecutive switches,
both engines) always shows all 3 profiles.
2. Demo subscriptions scale with the profile tier: low = Netflix + Spotify (cheap
plans), mid adds YouTube Premium / Disney+ / iCloud+ / Amazon Prime, high carries a
dozen incl. HBO Max, Xbox Game Pass, GitHub, Dropbox, Discord, Google One (renamed
from the brandless "Cloud Storage"). Names deliberately match subscriptionBrands
keywords so the Subscriptions view renders real brand icons. Contract test pins:
every seeded name resolves to a brand icon, tiers scale low<mid<high, sane shapes.
3. Storage-mode hardening: localStorage access in getStorageMode/setStorageMode was
unguarded — in blocked-storage contexts (strict private browsing) a throw silently
flipped the deployed build into server mode, so "demo" sessions fired real API
calls (the reported NetworkError burst). In-memory fallback keeps the session
consistent. Verified the reported endpoints are all served locally in demo:
0 API-origin requests and 0 console errors across 10 pages in both engines.
vitest config gains the Solid JSX plugin so tests can import .tsx modules.
Full suite: 336 passed; typecheck + eslint + prettier clean.
26 lines
798 B
TypeScript
26 lines
798 B
TypeScript
import { resolve } from 'path'
|
|
import { defineConfig } from 'vitest/config'
|
|
import solid from 'vite-plugin-solid'
|
|
|
|
export default defineConfig({
|
|
// Solid JSX transform so tests can import .tsx modules (components, brand icons).
|
|
plugins: [solid()],
|
|
resolve: {
|
|
alias: {
|
|
'@': resolve(__dirname, 'src'),
|
|
'@/core': resolve(__dirname, 'src/core'),
|
|
'@/features': resolve(__dirname, 'src/features'),
|
|
'@/components': resolve(__dirname, 'src/components'),
|
|
'@/stores': resolve(__dirname, 'src/stores'),
|
|
'@/types': resolve(__dirname, 'src/types'),
|
|
'@/lib': resolve(__dirname, 'src/lib'),
|
|
},
|
|
},
|
|
test: {
|
|
environment: 'jsdom',
|
|
globals: true,
|
|
include: ['src/**/__tests__/**/*.test.{ts,tsx}'],
|
|
setupFiles: ['./src/test-setup.ts'],
|
|
},
|
|
})
|