@@ -38,6 +38,7 @@ import type {
38
38
import { classMap } from 'lit-html/directives/class-map.js' ;
39
39
import { newConfigurePluginEvent , ConfigurePluginEvent } from '@openscd/open-scd/src/plugin.events.js' ;
40
40
import { newLogEvent } from '@openscd/core/foundation/deprecated/history.js' ;
41
+ import packageJson from '../package.json' ;
41
42
42
43
/** The `<open-scd>` custom element is the main entry point of the
43
44
* Open Substation Configuration Designer. */
@@ -166,7 +167,8 @@ export class OpenSCD extends LitElement {
166
167
167
168
connectedCallback ( ) : void {
168
169
super . connectedCallback ( ) ;
169
- this . loadPlugins ( )
170
+ this . checkAppVersion ( ) ;
171
+ this . loadPlugins ( ) ;
170
172
171
173
// TODO: let Lit handle the event listeners, move to render()
172
174
this . addEventListener ( 'reset-plugins' , this . resetPlugins ) ;
@@ -423,6 +425,16 @@ get parsedPlugins(): Plugin[] {
423
425
} ;
424
426
}
425
427
428
+ private checkAppVersion ( ) : void {
429
+ const currentVersion = packageJson . version ;
430
+ const storedVersion = localStorage . getItem ( 'appVersion' ) ;
431
+
432
+ if ( storedVersion !== currentVersion ) {
433
+ localStorage . setItem ( 'appVersion' , currentVersion ) ;
434
+ localStorage . removeItem ( 'plugins' ) ;
435
+ }
436
+ }
437
+
426
438
@state ( ) private loadedPlugins = new Set < string > ( ) ;
427
439
428
440
// PLUGGING INTERFACES
0 commit comments