-
Notifications
You must be signed in to change notification settings - Fork 160
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
Open recent files from within a sheet #2054
base: qa
Are you sure you want to change the base?
Conversation
QA Wolf here! As you write new code it's important that your test coverage is keeping up. |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## qa #2054 +/- ##
=======================================
Coverage 90.82% 90.82%
=======================================
Files 260 260
Lines 57534 57534
=======================================
Hits 52257 52257
Misses 5277 5277 ☔ View full report in Codecov by Sentry. |
Recent files seems like it should come from the API |
Agreed. But for a v1, this seems to work w/o having to change APIs. |
@@ -101,6 +102,7 @@ export const deleteFile = { | |||
try { | |||
const data = getActionFileDelete({ userEmail, redirect }); | |||
submit(data, { method: 'POST', action: ROUTES.API.FILE(uuid), encType: 'application/json' }); | |||
updateRecentFiles(uuid, '', false); |
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.
This should happen in quadratic-client/src/routes/api.files.$uuid.ts
in the delete action
If you put it in this file, then if a user deletes a file from the dashboard you won't see that reflected in your files list.
export const clearRecentFiles = () => { | ||
localStorage.removeItem(RECENT_FILES_KEY); | ||
window.dispatchEvent(new Event('local-storage')); | ||
}; |
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 feel like this file should be put in quadratic-client/src/shared
somewhere, because its functionality that really is shared between the app and the dashboard, because if you delete a file on the dashboard you'll want this code to run (which is what this comment is about).
So this should live outside of src/app
since it's not just specific to the app, but shared between the app and the dashboard.
@@ -126,12 +127,14 @@ export function FilesListItemUserFile({ | |||
// Update on the server and optimistically in the UI | |||
const data: FileAction['request.rename'] = { action: 'rename', name: value }; | |||
fetcherRename.submit(data, fetcherSubmitOpts); | |||
updateRecentFiles(uuid, value, true, true); |
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.
Similar feedback here, if you move these into the routes file, you won't have to find every place where you rename or delete a file across both the dashboard and the app.
This adds an Open recent file > submenu to the file menu. This stores the local file list in local storage.
Future: