@@ -5,7 +5,16 @@ import { Select } from './Select'
55import { Framework , getLibrary , LibraryId } from '~/libraries'
66import { getFrameworkOptions } from '~/libraries/frameworks'
77import { useCurrentUserQuery } from '~/hooks/useCurrentUser'
8- import { updateLastUsedFramework } from '~/utils/users.server'
8+
9+ function persistFrameworkToServer ( framework : string ) {
10+ import ( '~/utils/users.server' )
11+ . then ( ( { updateLastUsedFramework } ) =>
12+ updateLastUsedFramework ( { data : { framework } } ) ,
13+ )
14+ . catch ( ( ) => {
15+ // Silently ignore errors - localStorage is the fallback
16+ } )
17+ }
918
1019export function FrameworkSelect ( { libraryId } : { libraryId : LibraryId } ) {
1120 const library = getLibrary ( libraryId )
@@ -74,9 +83,7 @@ export function usePersistFrameworkPreference() {
7483 localCurrentFramework . setCurrentFramework ( framework )
7584 // Update DB for logged-in users (fire-and-forget)
7685 if ( userQuery . data ) {
77- updateLastUsedFramework ( { data : { framework } } ) . catch ( ( ) => {
78- // Silently ignore errors - localStorage is the fallback
79- } )
86+ persistFrameworkToServer ( framework )
8087 }
8188 } ,
8289 [ localCurrentFramework , userQuery . data ] ,
@@ -136,9 +143,7 @@ export function useCurrentFramework(frameworks: Framework[]) {
136143 localCurrentFramework . setCurrentFramework ( framework )
137144 // Update DB for logged-in users (fire-and-forget)
138145 if ( userQuery . data ) {
139- updateLastUsedFramework ( { data : { framework } } ) . catch ( ( ) => {
140- // Silently ignore errors - localStorage is the fallback
141- } )
146+ persistFrameworkToServer ( framework )
142147 }
143148 } ,
144149 [ localCurrentFramework , navigate , userQuery . data ] ,
0 commit comments