Closed probablycorey closed 7 years ago
My comment before you go updating tests is does this seem to work when you manually test the app? So you archive an issue, exit the app, reopen it, refresh the list, and that same issue still does not appear because it's still archived. You click 'View hidden' and confirm that issue is listed there. Likewise for ignoring and snoozing tasks.
Are archivedAt and snoozedAt times getting persisted as well? We'll need those to know when to make a task visible again.
If all that still seems the same, this is a great change since it's simplifying things so much! I knew it felt off that we were using this auto-rehydrater logic for persisting state but we had a manual JSON storage, too. I like unifying the two so all changes persisted to disk are done so through only one tool.
The hidden stuff doesn't work because we null that info out. But I think I can show all tasks without needing to null that info out.
Nevermind what I said about the 'View hidden' stuff. I didn't understand what TASKS_RESTORE
did. Now that I do I can verify that it works!
Do we know the path to the file that AsyncNodeStorage uses? I like periodically cat
ing out the electron-config JSON file to check which tasks are snoozed, etc. for debugging.
Do we know the path to the file that AsyncNodeStorage uses? I like periodically cating out the electron-config JSON file to check which tasks are snoozed, etc. for debugging.
You can find this out running console.log(persistDir)
on https://github.com/cheshire137/gh-notifications-snoozer/blob/remove-state/src/index.jsx#L13
For me that becomes /Users/probablycorey/Library/Application\ Support/Electron/reduxPersist%3Atasks
. It could use a better file name!
Elaborating on what I said in Slack, if this doesn't work when you change filters, I think it's because we're persisting tasks as a whole here. So if issue-123 comes in via one filter, I snooze it, then I switch filters, issue-123 will be visible for that filter. That's because issue-123 has a snoozedAt for the first filter, but not for the second.
Could we have another reducer that persists storageKey + archivedAt/snoozedAt/ignored status?
This PR does two things:
All state is automatically saved via
AsyncNodeStorage
in index.jsx. So we never have to think about it!We need to remember if we snoozed/archived/ignored the tasks. I don't think there is a need to empty the list first.