Skip to content
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

@uppy/companion - Fetch all Google Drive shared drives #3553

Merged
merged 2 commits into from
Mar 13, 2022

Conversation

rdimartino
Copy link
Contributor

Fixes #3539

By default Google only returns 10 shared drives in fetchSharedDrives. I have more than that so some of mine were missing from the file picker.

On main, 10 shared drives are loaded before my folders and files.

image

Two changes in this PR

The first and smallest one was to increase the pageSize for listing shared drives to the maximum of 100. This is probably good enough for most use-cases (and would be for mine).

The second was to check the response to fetchSharedDrives and see if a nextPageToken was returned and to continue fetching shared drives until no page token is returned. This is different from how the file pagination works, but I couldn't figure out how to keep track of two cursors (one for the shared drives and one for the files) for subsequent pagination requests on scroll. I was able to test these changes locally by setting the pageSize to something really small like 3 and confirming that all my shared drives were loaded. It does take longer to load if there are additional pages of shared drives, but that would only affect people with more than 100 shared drives (because of the first change) and that seemed like a reasonable trade-off to me.

Here is evidence of this working from this branch. Note there were more shared drives than would fit on one screen, but I checked and all the ones I had access to were loaded.

image

@arturi arturi requested a review from mifi March 10, 2022 12:55
@mifi
Copy link
Contributor

mifi commented Mar 11, 2022

thanks! I did a slight rewrite. hope that's ok and that i didn't break anything

@rdimartino
Copy link
Contributor Author

Looks great! Everything still works for me, thanks!

@mifi mifi merged commit 974be7c into transloadit:main Mar 13, 2022
Murderlon added a commit that referenced this pull request Mar 14, 2022
* main:
  Abstract restriction logic in a new Restricter class (#3532)
  @uppy/companion - Fetch all Google Drive shared drives (#3553)
  website: add blog post 2.4-2.7 (#3557)
  meta: fix e2e (#3562)
  fix broken link (#3559)
  meta: fix support of export declaration in source files (#3558)
  Order Google Drive results by folder to show all folders first (#3546)
  add corsOrigins to docs (#3554)
  @uppy/audio: refactor to ESM (#3470)
  @uppy/locales: compressor cleanup (#3531)
  meta: fix CJS interop in Vite config (#3543)
  upgrade node-redis-pubsub (#3541)
github-actions bot added a commit that referenced this pull request Mar 16, 2022
| Package              | Version | Package              | Version |
| -------------------- | ------- | -------------------- | ------- |
| @uppy/audio          |   0.3.0 | @uppy/locales        |   2.0.8 |
| @uppy/aws-s3         |   2.0.8 | @uppy/provider-views |   2.0.8 |
| @uppy/companion      |   3.4.0 | @uppy/vue            |   0.4.6 |
| @uppy/compressor     |   0.2.3 | @uppy/robodog        |   2.4.0 |
| @uppy/core           |   2.1.6 | uppy                 |   2.8.0 |
| @uppy/drop-target    |   1.1.2 |                      |         |

- @uppy/aws-s3: fix wrong events being sent to companion (Mikael Finstad / #3576)
- @uppy/compressor: ignore remote files, calculate savings correctly (Artur Paikin / #3578)
- @uppy/companion: always log errors with stack trace (Mikael Finstad / #3573)
- meta: remove incorrect s3 documentation (Mikael Finstad / #3571)
- @uppy/companion: Companion refactor (Mikael Finstad / #3542)
- website: partial ooops (Artur Paikin)
- meta: run e2e workflow on the head branch instead of the base one (Antoine du Hamel / #3561)
- website: Use Plausible instead of Google Analytics (Artur Paikin / #3567)
- @uppy/vue: enforce use of file extension within the import path (Antoine du Hamel / #3560)
- @uppy/drop-target: ignore if dropped elements aren't files (Penar Musaraj / #3563)
- @uppy/core: Abstract restriction logic in a new Restricter class (Merlijn Vos / #3532)
- @uppy/companion: Fetch all Google Drive shared drives (Robert DiMartino / #3553)
- website: add blog post 2.4-2.7 (Artur Paikin / #3557)
- meta: fix e2e (Antoine du Hamel / #3562)
- meta: fix broken link (YukeshShr / #3559)
- meta: fix support of export declaration in source files (Antoine du Hamel / #3558)
- @uppy/companion: Order Google Drive results by folder to show all folders first (Robert DiMartino / #3546)
- meta: add corsOrigins to docs (Mikael Finstad / #3554)
- @uppy/audio: refactor to ESM (Antoine du Hamel / #3470)
- @uppy/locales: compressor cleanup (Antoine du Hamel / #3531)
- meta: fix CJS interop in Vite config (Antoine du Hamel / #3543)
- @uppy/companion: upgrade node-redis-pubsub (Mikael Finstad / #3541)
- @uppy/provider-views: provider-view: fix breadcrumbs (Artur Paikin / #3535)
- meta: Update BACKLOG.md (Artur Paikin)
- @uppy/locales: Update ru_RU.js (Sobakin Sviatoslav / #3529)
- @uppy/companion: reorder reqToOptions (Antoine du Hamel / #3530)
- meta: Fix yarn caching in github actions (Mikael Finstad / #3526)
vymao pushed a commit to vymao/uppy that referenced this pull request Mar 29, 2022
* main:
  Abstract restriction logic in a new Restricter class (transloadit#3532)
  @uppy/companion - Fetch all Google Drive shared drives (transloadit#3553)
  website: add blog post 2.4-2.7 (transloadit#3557)
  meta: fix e2e (transloadit#3562)
  fix broken link (transloadit#3559)
  meta: fix support of export declaration in source files (transloadit#3558)
  Order Google Drive results by folder to show all folders first (transloadit#3546)
  add corsOrigins to docs (transloadit#3554)
  @uppy/audio: refactor to ESM (transloadit#3470)
  @uppy/locales: compressor cleanup (transloadit#3531)
  meta: fix CJS interop in Vite config (transloadit#3543)
  upgrade node-redis-pubsub (transloadit#3541)
vymao pushed a commit to vymao/uppy that referenced this pull request Mar 29, 2022
| Package              | Version | Package              | Version |
| -------------------- | ------- | -------------------- | ------- |
| @uppy/audio          |   0.3.0 | @uppy/locales        |   2.0.8 |
| @uppy/aws-s3         |   2.0.8 | @uppy/provider-views |   2.0.8 |
| @uppy/companion      |   3.4.0 | @uppy/vue            |   0.4.6 |
| @uppy/compressor     |   0.2.3 | @uppy/robodog        |   2.4.0 |
| @uppy/core           |   2.1.6 | uppy                 |   2.8.0 |
| @uppy/drop-target    |   1.1.2 |                      |         |

- @uppy/aws-s3: fix wrong events being sent to companion (Mikael Finstad / transloadit#3576)
- @uppy/compressor: ignore remote files, calculate savings correctly (Artur Paikin / transloadit#3578)
- @uppy/companion: always log errors with stack trace (Mikael Finstad / transloadit#3573)
- meta: remove incorrect s3 documentation (Mikael Finstad / transloadit#3571)
- @uppy/companion: Companion refactor (Mikael Finstad / transloadit#3542)
- website: partial ooops (Artur Paikin)
- meta: run e2e workflow on the head branch instead of the base one (Antoine du Hamel / transloadit#3561)
- website: Use Plausible instead of Google Analytics (Artur Paikin / transloadit#3567)
- @uppy/vue: enforce use of file extension within the import path (Antoine du Hamel / transloadit#3560)
- @uppy/drop-target: ignore if dropped elements aren't files (Penar Musaraj / transloadit#3563)
- @uppy/core: Abstract restriction logic in a new Restricter class (Merlijn Vos / transloadit#3532)
- @uppy/companion: Fetch all Google Drive shared drives (Robert DiMartino / transloadit#3553)
- website: add blog post 2.4-2.7 (Artur Paikin / transloadit#3557)
- meta: fix e2e (Antoine du Hamel / transloadit#3562)
- meta: fix broken link (YukeshShr / transloadit#3559)
- meta: fix support of export declaration in source files (Antoine du Hamel / transloadit#3558)
- @uppy/companion: Order Google Drive results by folder to show all folders first (Robert DiMartino / transloadit#3546)
- meta: add corsOrigins to docs (Mikael Finstad / transloadit#3554)
- @uppy/audio: refactor to ESM (Antoine du Hamel / transloadit#3470)
- @uppy/locales: compressor cleanup (Antoine du Hamel / transloadit#3531)
- meta: fix CJS interop in Vite config (Antoine du Hamel / transloadit#3543)
- @uppy/companion: upgrade node-redis-pubsub (Mikael Finstad / transloadit#3541)
- @uppy/provider-views: provider-view: fix breadcrumbs (Artur Paikin / transloadit#3535)
- meta: Update BACKLOG.md (Artur Paikin)
- @uppy/locales: Update ru_RU.js (Sobakin Sviatoslav / transloadit#3529)
- @uppy/companion: reorder reqToOptions (Antoine du Hamel / transloadit#3530)
- meta: Fix yarn caching in github actions (Mikael Finstad / transloadit#3526)
HeavenFox pushed a commit to docsend/uppy that referenced this pull request Jun 27, 2023
)

* @uppy/companion - Fetch all Google Drive shared drives0

* simplify and improve

Co-authored-by: Mikael Finstad <[email protected]>
HeavenFox pushed a commit to docsend/uppy that referenced this pull request Jun 27, 2023
| Package              | Version | Package              | Version |
| -------------------- | ------- | -------------------- | ------- |
| @uppy/audio          |   0.3.0 | @uppy/locales        |   2.0.8 |
| @uppy/aws-s3         |   2.0.8 | @uppy/provider-views |   2.0.8 |
| @uppy/companion      |   3.4.0 | @uppy/vue            |   0.4.6 |
| @uppy/compressor     |   0.2.3 | @uppy/robodog        |   2.4.0 |
| @uppy/core           |   2.1.6 | uppy                 |   2.8.0 |
| @uppy/drop-target    |   1.1.2 |                      |         |

- @uppy/aws-s3: fix wrong events being sent to companion (Mikael Finstad / transloadit#3576)
- @uppy/compressor: ignore remote files, calculate savings correctly (Artur Paikin / transloadit#3578)
- @uppy/companion: always log errors with stack trace (Mikael Finstad / transloadit#3573)
- meta: remove incorrect s3 documentation (Mikael Finstad / transloadit#3571)
- @uppy/companion: Companion refactor (Mikael Finstad / transloadit#3542)
- website: partial ooops (Artur Paikin)
- meta: run e2e workflow on the head branch instead of the base one (Antoine du Hamel / transloadit#3561)
- website: Use Plausible instead of Google Analytics (Artur Paikin / transloadit#3567)
- @uppy/vue: enforce use of file extension within the import path (Antoine du Hamel / transloadit#3560)
- @uppy/drop-target: ignore if dropped elements aren't files (Penar Musaraj / transloadit#3563)
- @uppy/core: Abstract restriction logic in a new Restricter class (Merlijn Vos / transloadit#3532)
- @uppy/companion: Fetch all Google Drive shared drives (Robert DiMartino / transloadit#3553)
- website: add blog post 2.4-2.7 (Artur Paikin / transloadit#3557)
- meta: fix e2e (Antoine du Hamel / transloadit#3562)
- meta: fix broken link (YukeshShr / transloadit#3559)
- meta: fix support of export declaration in source files (Antoine du Hamel / transloadit#3558)
- @uppy/companion: Order Google Drive results by folder to show all folders first (Robert DiMartino / transloadit#3546)
- meta: add corsOrigins to docs (Mikael Finstad / transloadit#3554)
- @uppy/audio: refactor to ESM (Antoine du Hamel / transloadit#3470)
- @uppy/locales: compressor cleanup (Antoine du Hamel / transloadit#3531)
- meta: fix CJS interop in Vite config (Antoine du Hamel / transloadit#3543)
- @uppy/companion: upgrade node-redis-pubsub (Mikael Finstad / transloadit#3541)
- @uppy/provider-views: provider-view: fix breadcrumbs (Artur Paikin / transloadit#3535)
- meta: Update BACKLOG.md (Artur Paikin)
- @uppy/locales: Update ru_RU.js (Sobakin Sviatoslav / transloadit#3529)
- @uppy/companion: reorder reqToOptions (Antoine du Hamel / transloadit#3530)
- meta: Fix yarn caching in github actions (Mikael Finstad / transloadit#3526)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Google Drive doesn't show more than 10 shared drives
4 participants