cheshire137 / gh-notifications-snoozer

Lists and filters and snoozing pull requests, oh my! This is an app for managing your notifications on GitHub by way of filtering issues and pull requests that are of interest to you.
MIT License
15 stars 10 forks source link

Remove storage from Reducer #96

Closed probablycorey closed 7 years ago

probablycorey commented 8 years ago

This PR does two things:

  1. Removes all the storage and state calls from the reducer

All state is automatically saved via AsyncNodeStorage in index.jsx. So we never have to think about it!

  1. Refreshing the task list doesn't empty the filter state

We need to remember if we snoozed/archived/ignored the tasks. I don't think there is a need to empty the list first.

cheshire137 commented 8 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.

probablycorey commented 8 years ago

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.

probablycorey commented 8 years ago

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!

cheshire137 commented 8 years ago

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.

probablycorey commented 8 years ago

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!

cheshire137 commented 8 years ago

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?