Notifio lives in the system tray. Click the tray icon and a window appears, and because of an empty event handler and a deliberate reload, what appears is a brand new renderer: fresh React tree, fresh state, every component mounting for the first time. The app is on the download page if you want to watch it happen.
When I wrote that post I said the renderer "may not remember anything", and I meant it as an architectural rule: product state belongs to the main process, the window is a view onto it, and anything the window tries to keep is a bug waiting for the next reload. Everything the UI shows arrives over a local event stream, which opens with a couple of hundred frames precisely so a newborn renderer can catch up in one go.
Then I went and grepped the renderer for every browser storage API, because "may not remember anything" is a claim and claims are checkable.
grep -rn "localStorage\|sessionStorage\|indexedDB\|document.cookie" src/renderer
src/renderer/components/MainApp.tsx:29: const stored = Number(window.localStorage.getItem(SEEN_KEY));
src/renderer/components/MainApp.tsx:39: window.localStorage.setItem(SEEN_KEY, String(now));
Two hits in 21 files and 3,144 lines. One key, read in one place and written in one other, and nothing else: zero sessionStorage, zero indexedDB, zero cookies.
The one key
/** Remembers when the finds list was last looked at, so the badge means something. */
const SEEN_KEY = "notifio.findsSeenAt";
It is a millisecond timestamp, and the whole of its purpose is one number on screen:
const unseenFinds = app.finds.filter((f) => f.foundAt > findsSeenAt).length;
The app has three tabs, and the Finds tab carries a count of listings found since you last looked. That count needs to know when you last looked, and "when you last looked" is not a fact the main process can possibly have. It is not in the config, it is not in the ledger, it is not in finds.json. It is a fact about a person's attention, produced by the window, meaningful only to the window, and lost on every reload unless the window writes it down.
So this is the exception that proves the rule rather than breaking it. The rule is that the renderer does not persist product state. A timestamp of when a human last glanced at a tab is not product state.
Three statements, and one of them is more careful than it looks
The read is a lazy initialiser:
const [findsSeenAt, setFindsSeenAt] = useState<number>(() => {
const stored = Number(window.localStorage.getItem(SEEN_KEY));
return Number.isFinite(stored) ? stored : 0;
});
getItem returns null when the key is absent, Number(null) is 0, and 0 is finite, so a first run falls through the guard and lands on 0 anyway. The guard exists for the other case: a key that somehow holds "abc" gives NaN, Number.isFinite(NaN) is false, and the fallback catches it. Without that line a corrupted value would make every comparison against foundAt false and the badge would silently read zero forever. One line turns a permanently wrong badge into a badge that starts over.
The write is an effect, and the interesting part is its dependency array:
useEffect(() => {
if (tab !== "finds") return;
const now = Date.now();
window.localStorage.setItem(SEEN_KEY, String(now));
setFindsSeenAt(now);
}, [tab, app.finds.length]);
Opening the tab is what counts as having seen the list, so the stamp moves when you switch to it. But it also moves when app.finds.length changes while you are already on the tab, which means a listing that arrives while you are looking at the list is marked seen immediately rather than lighting up a badge on the tab you are currently reading. That behaviour is one array element, and it would be very easy to write this effect with [tab] alone and never notice that the badge nags you about rows already on your screen.
Where that key actually lives
This is the part I had not thought about until I went looking for the file.
The renderer is not a file:// page. The app serves its own UI over HTTP from a local Express server, and the window loads it:
let serverPort = Number(process.env.PORT) || 3000;
// ...
mainWindow.loadURL(`http://localhost:${serverPort}`);
localStorage is partitioned by origin, and an origin includes the port. So the key belongs to http://localhost:3000, not to Notifio as such. The port is a fixed 3000 with no scanning and no fallback, which is what makes the badge survive a restart at all: were the server to pick a free port each launch, every launch would be a new origin and the timestamp would be gone every time. A one-line port default is load-bearing for a UI affordance four files away.
And physically, Chromium puts that origin's storage inside the app's own userData directory, the same ~/Library/Application Support/Notifio that holds every file the main process writes. Which matters because of a promise on the website. The privacy page tells you that everything kept on your device can be removed by deleting that folder, and when I audited the eight things it lists I was counting files written by our code. This key is a ninth thing, nothing in our code enumerates it, no uninstall routine mentions it, and the promise still holds, because Chromium happened to put it in the directory the policy already names.
Accidentally correct is not the same as correct. It is worth knowing which one you have.
What the audit was worth
renderer files 21
renderer lines 3,144
localStorage keys 1
localStorage call sites 2
sessionStorage / IndexedDB / cookies 0
state that survives a reload one timestamp
I went in expecting to find either nothing, which would have confirmed the earlier post, or a handful of keys quietly accumulating, which is the normal outcome of a year of UI work. Instead there is exactly one, it is the one piece of state that genuinely cannot live anywhere else, and the three statements implementing it each have a detail in them worth defending.
The behaviour is visible in about thirty seconds of using the app: open the window, leave it on the Monitor tab, wait for something to turn up, and the Finds tab gets a number. Switch to it and the number is gone, permanently, even if you close the window and the whole UI is rebuilt from scratch next time. What the app does in between is described on the help page.
Top comments (0)