Commit 415efc9
refactor: fix first-paint viewport check and split colliding route constants
Three deliberate behaviour changes.
1. usePlatform -> useIsMobile, with a correct initial value.
The hook was a viewport media query wearing the name of the platform seam.
Mantine 9.5 defaults to getInitialValueInEffect: true and ends with
`return matches || false`, so with no initial value the first render
reported "not desktop" everywhere - including the 800px-wide extension
popup. Every consumer painted a mobile layout for one frame: Bookmark
mounted each row as an <a href> and then swapped it for plain text, and
Persons computed a mobile column count and row height.
The fix passes `true`, not `false`. Passing `false` would be a no-op,
since `matches || false` already yields false today. Deliberately not
using getInitialValueInEffect: false, which reads window.matchMedia during
render and would risk a Next.js hydration mismatch.
Trade-off: real mobile web (<768px) now gets a one-frame desktop paint
instead.
2. ToggleExtension: one source of truth.
The component kept a local extState whose getIsExtensionActive() was
exactly the store's isExtensionActive, with dispatchActionAndSetState
existing only to write both. useExtStore now exposes
{ isExtensionActive, setIsExtensionActive } instead of the always-paired
turnOnExtension/turnOffExtension.
The store default stays true on purpose: Authenticate reads it on mount
and would auto-sign-out if it started false while storage resolves.
Trade-off: the first-paint flash moves rather than disappearing. Today a
stored-ACTIVE user sees unchecked->checked; now a stored-INACTIVE user
sees checked->unchecked. Removing it entirely needs the store hydrated
before first paint.
3. Split the colliding ROUTES.
@bypass/shared exported HOMEPAGE: '/popup.html' while the web app
exported its own ROUTES with HOMEPAGE: '/'. The web app imported both,
three lines apart in two files, under the same identifier - so one wrong
auto-import was a silent 404 or a broken RESTRICTED_PATHS check with no
type error.
Shared ROUTES now holds only the genuinely shared panel routes. The
extension entry route moves to POPUP_HOMEPAGE in the extension, and the
web constant is renamed WEB_ROUTES so the two cannot be confused.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>1 parent 62ed560 commit 415efc9
13 files changed
Lines changed: 59 additions & 51 deletions
File tree
- apps
- extension/src
- constants
- entrypoints/popup/panels/HomePopup
- components
- routes
- store
- web/src/app
- components
- constants
- provider
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
Lines changed: 11 additions & 24 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
23 | 13 | | |
24 | 14 | | |
25 | 15 | | |
26 | | - | |
27 | | - | |
28 | | - | |
| 16 | + | |
| 17 | + | |
29 | 18 | | |
30 | | - | |
| 19 | + | |
31 | 20 | | |
32 | 21 | | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
38 | 26 | | |
39 | 27 | | |
40 | | - | |
41 | 28 | | |
42 | 29 | | |
43 | 30 | | |
| |||
Lines changed: 3 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | 1 | | |
3 | 2 | | |
| 3 | + | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
7 | | - | |
| 8 | + | |
8 | 9 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | | - | |
| 5 | + | |
7 | 6 | | |
8 | 7 | | |
9 | 8 | | |
| 9 | + | |
| 10 | + | |
10 | 11 | | |
11 | | - | |
12 | | - | |
| 12 | + | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
2 | 6 | | |
3 | 7 | | |
4 | 8 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
| 39 | + | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
| 45 | + | |
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
1 | 6 | | |
2 | | - | |
3 | 7 | | |
4 | 8 | | |
5 | 9 | | |
| |||
0 commit comments