File tree Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -49,13 +49,21 @@ function waitForContentAndStore() {
4949 observer . disconnect ( ) ;
5050 const data = await getProblemData ( ) ;
5151 if ( ! data ) return ; // Don't store invalid/undefined problems
52- browser . storage . local . set ( { [ data . slug ] : data } ) . then ( ( ) => {
53- console . log ( "Saved to storage:" , data ) ;
54- } ) . catch ( ( err ) => {
55- console . error ( "Storage error:" , err ) ;
52+ // Preserve existing status and solvedAt if present
53+ browser . storage . local . get ( data . slug ) . then ( ( existing ) => {
54+ const prev = existing [ data . slug ] || { } ;
55+ if ( prev . status === "Solved" ) {
56+ data . status = prev . status ;
57+ data . solvedAt = prev . solvedAt ;
58+ }
59+ browser . storage . local . set ( { [ data . slug ] : data } ) . then ( ( ) => {
60+ console . log ( "Saved to storage:" , data ) ;
61+ } ) . catch ( ( err ) => {
62+ console . error ( "Storage error:" , err ) ;
63+ } ) ;
64+ // Start watching for submission result after we have the slug
65+ waitForSubmissionResult ( data . slug ) ;
5666 } ) ;
57- // Start watching for submission result after we have the slug
58- waitForSubmissionResult ( data . slug ) ;
5967 }
6068 } ) ;
6169
You can’t perform that action at this time.
0 commit comments