-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Provider views rewrite (.files, .folders => .partialTree) #5050
base: 4.x
Are you sure you want to change the base?
Conversation
GoogleDrive - travelling down into folders works - checking a file works - breadcrumbs DONT work
…ed()` Clarification: `.toReversed()` is no supported by all browsers
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.
EXPLANATION
We don't need this code, because we hide checkmarks for team drives in <ListItem/>
now (see #5232).
This version was leading to a weird behaviour where the checkbox was there, but it wasn't working.
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.
EXPLANATION
These changes are here just to remove the /* eslint-disable react/require-default-props */
line.
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.
EXPLANATION
Again - these changes are here just to remove the /* eslint-disable react/require-default-props */
line.
<span className="uppy-ProviderBrowser-user" key="username"> | ||
{username} | ||
</span> | ||
{username && ( |
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.
EXPLANATION
This username &&
thing fixes the issue in some providers where we would see a small dot even when we don't have the username (doesn't look good).
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.
EXPLANATION
Hugely simplifying <SearchInput/>
here by making it a controlled component.
That's also why we don't need nanoid
anymore.
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.
EXPLANATION
Removed View.ts
, all code from here moves to ProviderView.ts
and SearchProviderView.ts
.
Pretty much all of the code that was in the View.ts
superclass needed to be moved into /utils
files (code is complex enough to deserve a predictable util file that's easy to single out to work on & to unit test), so View.ts
was becoming thinner and thinner as I went on.
When ProviderView.ts
and SearchProviderView.ts
have the same behaviour, they just use the same function from /utils
now.
As a bonus, removing View.ts
superclass makes the types much more straightforward, and removes "method from childClass calls a method from superClass which depends on a method from childClass" situations.
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 very happy with the functionality! Congrats.
Unfortunately the PR is overwhelmingly big, I'm having a hard time reviewing it.
A lot of time went into this already and there are code comments, tests, and from a glance most things seem very well structured. So I don't think it makes sense to force you to split this up into many PRs.
But I would like to point out that I do see it as an expectation to know how to make small PRs, and this could've probably been 5 to 10 PRs. It's more a note for us as a team (I'm also still improving at forcing myself to make small PRs).
// TODO: document what is a "tagFile" or get rid of this concept | ||
const getTagFile = <M extends Meta, B extends Body>( |
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.
Did it became more clear to you why this is needed?
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.
[To be clear to onlookers - it's not my comment, I carried this comment over from another file]
I didn't dive into this, but can be my next PR, I'm deep enough in this context.
I'll record this in my #todos.
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's not too important, if you happened to know we could've add a comment :)
Realistically the only way this could have been a set of smaller PRs is if I have been splitting this PR post-factum. There hasn't been a way forward with a number of smaller PRs. I changed the underlying data structure multiple times as I was going through with this PR, and every such overhaul was touching most files. It's only now clear what smaller PRs could have been of use in the final version. I can still do the post-factum split, but I don't believe it will significantly ease the review for you - the main workload of this PR is in changing the data structure used throughout provider views, which by its nature touches 40 files. Sometimes (say, when the data structure used by all files changes completely) a big PR is unavoidable. I understand it's challenging to review - like mentioned in the PR description, I suggest going through the folders in your editor, and seeing if it make sense. In particular would be great if the reviewers could go through code in |
Description
enables indeterminate checkmark states
[fixes Nested folder selection does not work correctly #4609]
enables folder caching
fixes the issue where Unsplash was only loading one page
[fixes Unsplash doesn't load further pages #5000]
reworks restrictions system
[fixes Fix logic with adding folders toast message #4414]
In particular aggregate restrictions are now shown in the footer:
absDirPath
andrelDirPath
are injected in a single place[fixes pull/4537#discussion_r1260683896]
nOfSelectedFiles
is as smart as it gets nowfixes the UI issue where shift-clicking files gets them highlighted:
fixes the way shift-clicking works in grid providers such as Instagram/Unpslash
[fixes Shift-clicking works chaotically with Instagram/Unsplash #5063]
makes the GoogleDrive's VIRTUAL_SHARED_DIR checkable
[see this discussion transloadit.slack.com/archives/C0FMW9PSB/p1714529071856209]
TODOs
1. signing in 2. checking deeply nested folders 3. downloading them 4. signing out
works.[To reviewers: I'll do it, no need to check all providers yourselves]
TODOs for next PRs
I'll work on "mifi's PR + but custom handling for smaller n of files" in further PRs.
Notes to reviewers
.env
in Slack - it's underway, but not yet fully ready.If you need access to a particular provider - message me, and I'll send you the credentials.
This PR spans 2.5k lines across 46 files.
I separated some PRs from this PR, however further separation will make it harder to review rather than easier, this is largely a holistic change.
I think a sane way to review this PR (apart from looking through "Files changed" on github) would be to look through the code in
/uppy/packages/@uppy/provider-views
folder locally in your editor - just read the files and see if they make sense/if something worries you. Most of these files were updated/rewritten.