@@ -45,19 +45,18 @@ async function getProblemData() {
4545function waitForContentAndStore ( ) {
4646 const observer = new MutationObserver ( async ( ) => {
4747 const titleEl = document . querySelector ( "div" ) ;
48- if ( titleEl && titleEl . textContent . trim ( ) ) {
48+ if ( titleEl ? .textContent . trim ( ) ) {
4949 observer . disconnect ( ) ;
5050 const data = await getProblemData ( ) ;
5151 if ( ! data ) return ; // Don't store invalid/undefined problems
52- // Preserve existing status and solvedAt if present
52+ // Only update non- status fields, always preserve status/solvedAt
5353 browser . storage . local . get ( data . slug ) . then ( ( existing ) => {
5454 const prev = existing [ data . slug ] || { } ;
55- if ( prev . status === "Solved" ) {
56- data . status = prev . status ;
57- data . solvedAt = prev . solvedAt ;
58- }
55+ // Always preserve status and solvedAt if they exist
56+ if ( prev . status ) data . status = prev . status ;
57+ if ( prev . solvedAt ) data . solvedAt = prev . solvedAt ;
5958 browser . storage . local . set ( { [ data . slug ] : data } ) . then ( ( ) => {
60- console . log ( "Saved to storage:" , data ) ;
59+ console . log ( "Saved to storage (non-status fields updated) :" , data ) ;
6160 } ) . catch ( ( err ) => {
6261 console . error ( "Storage error:" , err ) ;
6362 } ) ;
@@ -73,7 +72,7 @@ function waitForContentAndStore() {
7372function waitForSubmissionResult ( slug ) {
7473 const observer = new MutationObserver ( ( ) => {
7574 const resultEl = document . querySelector ( 'span[data-e2e-locator="submission-result"]' ) ;
76- if ( resultEl && resultEl . textContent . includes ( "Accepted" ) ) {
75+ if ( resultEl ? .textContent . includes ( "Accepted" ) ) {
7776 console . log ( "✅ Accepted detected via submission result!" ) ;
7877
7978 browser . storage . local . get ( slug ) . then ( ( existing ) => {
0 commit comments