File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,7 +12,8 @@ function setStatus(message) {
1212function loadNote ( ) {
1313 let saved = "" ;
1414 try {
15- saved = localStorage . getItem ( "pinstick-note" ) ?? "" ;
15+ const stored = localStorage . getItem ( "pinstick-note" ) ;
16+ saved = stored === null ? "" : stored ;
1617 } catch ( err ) {
1718 console . warn ( "Unable to read saved note:" , err ) ;
1819 setStatus ( "Failed to load note; starting empty" ) ;
@@ -36,7 +37,10 @@ async function togglePin() {
3637 setStatus ( "Toggling pin…" ) ;
3738 try {
3839 const result = await invoke ( "toggle_pin" ) ;
39- const pinned = result ?. pinned ?? false ;
40+ const pinned =
41+ result && Object . prototype . hasOwnProperty . call ( result , "pinned" )
42+ ? result . pinned
43+ : false ;
4044 pinBtn . textContent = pinned ? "Unpin" : "Pin" ;
4145 setStatus ( pinned ? "Pinned on top" : "Not pinned" ) ;
4246 } catch ( err ) {
You can’t perform that action at this time.
0 commit comments