-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Include Drafts in Recently Viewed Documents #38
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks really good! Just wondering about error checking in a couple of spots so the dashboard doesn't break in case these new service methods error out.
return recentlyViewedDocs; | ||
}); | ||
if (this.recentDocs.all === null) { | ||
await this.recentDocs.fetchAll.perform(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add some error checking here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What did you have in mind? Here I'm relying on fetchAll
's error handling
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like fetchAll
just logs and throws an error so it would end up here? I might be missing something though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also this isn't necessarily a blocker, but I just wanted to make sure that the dashboard would still load if there was an error with fetchAll
- did you test that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see what you mean. Check out these changes: a634c7d
We now let failed fetchAll
s through and show an error in the template with the option to refresh.
In this example it's hard-coded to fail, but it should give you an idea of the implementation:
CleanShot.2023-03-22.at.21.00.57.mp4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, just one sorta open question about error handling, but otherwise LGTM!
* Add drafts to recentlyViewedDocs * Partial Mirage responses * Additional Mirage responses; initial passing test * Additional tests and template fixes * Include `@isDraft` arg * Write LegacyUsers test * Fix config and broken tests * Cleanup * Fix type errors; Update Mirage responses * Handle RecentDocs error in dashboard
Moves RecentlyViewedDocument functions from the dashboard route to a service. By detaching from the model hook, we make fewer network calls and get a faster, more reactive dashboard.
The service also expands to include drafts, and to accommodate legacy users, we transform the old list:
into the new format when
fetchAll
is called by the dashboard route:You can see for yourself locally. Log in and your recently viewed docs should be preserved. (Note: Your recent-docs list will reset when switching back to main.)