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
Fix/quick view #1611
Fix/quick view #1611
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.
Nice, two neat tricks.
However, would it be hard to add tests for this? If not I think they would be really helpful here.
I think adding tests to SharingsContainer should be doable since some are already there. For the "actions" part, it seems like a huge effort. @y-lohse be prepared, tomorrow I'll have to work on a new task so... :D |
Visual Review - Please review screenshots, then restart build. |
I don't think you can be sure that another action has not been be dispatched in the meantime. If this action has nothing to do with files fetching you still want to update the store with recent files.
For example, the store could look like this:
Of course it is a huge change and we probably can't do this to fix this bug but maybe we could create a technical card. |
You right. After 2 minutes of thinking, we can receive UPLOAD_SUCCESS or other related sync stuff. At first, I wanted to do something similar at what you proposed. It was a bit more complicated although. Your solution should be doable. |
Visual Review - Please review screenshots, then restart build. |
Visual Review - Please review screenshots, then restart build. |
Some news: We now have: files : { shared: [], recent: [], trashed: [], folder: [] },
currentView: 'recent' // https://github.com/cozy/cozy-drive/pull/1611/commits/4eeea76b527218031fafffc93b997c8a7b56a8d8#diff-47554ec30330a7ef6eb836864a43b9f4R78 Based on the I found out some "issues" doing this stuff:
But the delete_file is not dispatched by the click, but by the real time (4eeea76#diff-9d445e7faef1808a83ef82ea6ba523efR99). Since we're removing files here, we can have a race between this and this line
There is still a lot of work to be done:
|
Visual Review - Please review screenshots, then restart build. |
Visual Review - Please review screenshots, then restart build. |
Visual Review - Please review screenshots, then restart build. |
Visual Review - Please review screenshots, then restart build. |
folder, | ||
fileCount: folder.contents.meta.count || 0, | ||
files: folder.contents.data | ||
}) |
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.
IMHO this kind of thing should be done in the reducer. It should ignore the success if it is for the wrong id.
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.
You absolutely right! But we have a "special" reducer in drive. We splited / sliced our reducer and state. So for instance here https://github.com/cozy/cozy-drive/blob/master/src/drive/web/modules/navigation/duck/reducer.js#L197 I can't have a direct access to the "global" state since in this method I'm scoped. So no acess state.openedFolderId
:(
Maybe I missed something to get access to it. I'm very open to suggestion here !
Visual Review - Please review screenshots, then restart build. |
Several points in this PR :
We now have a concept of "view". View is based on our navigation system. Currently we have 4 views :
folder / trash / recent / sharings
For each of this view we have a special "slice" of the redux store to store the concerned files :
files : { shared: [], recent: [], trashed: [], folder: [] }
We have a selector to get the
currentView
based the latest dispatched action. It is not thedisplayedView
but the desired oneTried to use the redux store instead of the
location
when I could without rewriting a few big part of the app.Added lot of documentation about internal stuff