File tree Expand file tree Collapse file tree
packages/uhk-web/src/app/store/effects Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -316,8 +316,10 @@ export class UserConfigEffects {
316316 loadUserConfigurationFromFile$ = createEffect ( ( ) => this . actions$
317317 . pipe (
318318 ofType < LoadUserConfigurationFromFileAction > ( ActionTypes . LoadUserConfigurationFromFile ) ,
319- map ( action => action . payload ) ,
320- map ( ( payload : LoadUserConfigurationFromFilePayload ) => {
319+ withLatestFrom ( this . store . select ( getUserConfiguration ) ) ,
320+ map ( ( [ action , currentUserConfiguration ] ) : [ LoadUserConfigurationFromFilePayload , string ] =>
321+ [ action . payload , currentUserConfiguration . deviceName ] ) ,
322+ map ( ( [ payload , deviceName ] : [ LoadUserConfigurationFromFilePayload , string ] ) => {
321323 try {
322324 let userConfig = new UserConfiguration ( ) ;
323325
@@ -332,6 +334,10 @@ export class UserConfigEffects {
332334 if ( userConfig . userConfigMajorVersion ) {
333335 userConfig = this . uhk80MigratorService . migrate ( userConfig ) ;
334336
337+ // Keep the connected keyboard's name when importing a config, so a single config
338+ // can be shared across multiple keyboards while each retains its own name.
339+ userConfig . deviceName = deviceName ;
340+
335341 if ( payload . autoSave ) {
336342 return new ApplyUserConfigurationFromFileAction ( {
337343 userConfig,
You can’t perform that action at this time.
0 commit comments