@@ -41,7 +41,7 @@ const App = () => {
4141 const timer = useRef ( null )
4242
4343 useEffect ( ( ) => {
44- plugin . internalEvents . on ( 'verification_activated' , ( ) => {
44+ const initializePlugin = ( ) => {
4545 // @ts -ignore
4646 plugin . call ( 'locale' , 'currentLocale' ) . then ( ( locale : any ) => {
4747 setLocale ( locale )
@@ -51,6 +51,7 @@ const App = () => {
5151 plugin . on ( 'locale' , 'localeChanged' , ( locale : any ) => {
5252 setLocale ( locale )
5353 } )
54+
5455 // Fetch compiler artefacts initially
5556 plugin . call ( 'compilerArtefacts' as any , 'getAllCompilerAbstracts' ) . then ( ( obj : any ) => {
5657 setCompilationOutput ( obj )
@@ -60,7 +61,17 @@ const App = () => {
6061 plugin . on ( 'compilerArtefacts' as any , 'compilationSaved' , ( compilerAbstracts : { [ key : string ] : CompilerAbstract } ) => {
6162 setCompilationOutput ( ( prev ) => ( { ...( prev || { } ) , ...compilerAbstracts } ) )
6263 } )
63- } )
64+ }
65+
66+ // Check if plugin is already activated
67+ if ( plugin . isActivated ( ) ) {
68+ initializePlugin ( )
69+ } else {
70+ // Listen for activation event if not yet activated
71+ plugin . internalEvents . once ( 'verification_activated' , ( ) => {
72+ initializePlugin ( )
73+ } )
74+ }
6475
6576 // Fetch chains.json and update state
6677 fetch ( 'https://chainid.network/chains.json' )
0 commit comments