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

move useStore out of core #5533

Merged
merged 1 commit into from
Dec 2, 2024
Merged

move useStore out of core #5533

merged 1 commit into from
Dec 2, 2024

Conversation

mifi
Copy link
Contributor

@mifi mifi commented Dec 2, 2024

#5443 (comment) (cherry picked from commit 00070c870f76876aca92e97f410f8b52085191bc)

#5443 (comment)
(cherry picked from commit 00070c870f76876aca92e97f410f8b52085191bc)
@mifi mifi mentioned this pull request Dec 2, 2024
15 tasks
Copy link
Contributor

github-actions bot commented Dec 2, 2024

Diff output files
diff --git a/packages/@uppy/provider-views/lib/GooglePicker/GooglePickerView.js b/packages/@uppy/provider-views/lib/GooglePicker/GooglePickerView.js
index eda1e35..2348479 100644
--- a/packages/@uppy/provider-views/lib/GooglePicker/GooglePickerView.js
+++ b/packages/@uppy/provider-views/lib/GooglePicker/GooglePickerView.js
@@ -1,4 +1,3 @@
-import useStore from "@uppy/core/lib/useStore.js";
 import { h } from "preact";
 import { useCallback, useEffect, useRef, useState } from "preact/hooks";
 import AuthView from "../ProviderView/AuthView.js";
@@ -12,6 +11,22 @@ import {
   showPhotosPicker,
 } from "./googlePicker.js";
 import { GoogleDriveIcon, GooglePhotosIcon } from "./icons.js";
+function useStore(store, key) {
+  const [value, setValueState] = useState();
+  useEffect(() => {
+    (async () => {
+      setValueState(await store.getItem(key));
+    })();
+  }, [key, store]);
+  const setValue = useCallback(async v => {
+    setValueState(v);
+    if (v == null) {
+      return store.removeItem(key);
+    }
+    return store.setItem(key, v);
+  }, [key, store]);
+  return [value, setValue];
+}
 export default function GooglePickerView(_ref) {
   let {
     uppy,

@Murderlon Murderlon merged commit 0648fa7 into main Dec 2, 2024
16 checks passed
@Murderlon Murderlon deleted the useuppy-out-of-core branch December 2, 2024 16:32
github-actions bot added a commit that referenced this pull request Dec 5, 2024
| Package                    | Version | Package                    | Version |
| -------------------------- | ------- | -------------------------- | ------- |
| @uppy/audio                |   2.0.2 | @uppy/instagram            |   4.1.2 |
| @uppy/aws-s3               |   4.1.3 | @uppy/locales              |   4.3.1 |
| @uppy/box                  |   3.1.2 | @uppy/onedrive             |   4.1.2 |
| @uppy/companion            |   5.2.0 | @uppy/progress-bar         |   4.0.2 |
| @uppy/companion-client     |   4.2.0 | @uppy/provider-views       |   4.1.0 |
| @uppy/compressor           |   2.1.1 | @uppy/react                |   4.0.4 |
| @uppy/core                 |   4.3.0 | @uppy/remote-sources       |   2.2.1 |
| @uppy/dashboard            |   4.1.3 | @uppy/screen-capture       |   4.1.2 |
| @uppy/drag-drop            |   4.0.5 | @uppy/status-bar           |   4.0.5 |
| @uppy/drop-target          |   3.0.2 | @uppy/store-default        |   4.1.2 |
| @uppy/dropbox              |   4.1.2 | @uppy/thumbnail-generator  |   4.0.2 |
| @uppy/facebook             |   4.1.2 | @uppy/transloadit          |   4.1.4 |
| @uppy/file-input           |   4.0.4 | @uppy/tus                  |   4.1.5 |
| @uppy/form                 |   4.0.2 | @uppy/unsplash             |   4.1.2 |
| @uppy/golden-retriever     |   4.0.2 | @uppy/url                  |   4.1.2 |
| @uppy/google-drive         |   4.2.0 | @uppy/utils                |   6.0.5 |
| @uppy/google-drive-picker  |   0.2.0 | @uppy/vue                  |   2.0.3 |
| @uppy/google-photos        |   0.4.0 | @uppy/webcam               |   4.0.3 |
| @uppy/google-photos-picker |   0.2.0 | @uppy/xhr-upload           |   4.2.3 |
| @uppy/image-editor         |   3.2.1 | @uppy/zoom                 |   3.1.2 |
| @uppy/informer             |   4.1.2 | uppy                       |   4.8.0 |

- @uppy/companion-client: Fix allowed origins (Mikael Finstad / #5536)
- meta: Build lib refactor to esm (Mikael Finstad / #5537)
- @uppy/provider-views: Google picker scope (Mikael Finstad / #5535)
- @uppy/core,@uppy/provider-views: move useStore out of core (Mikael Finstad / #5533)
- @uppy/companion,@uppy/google-drive-picker,@uppy/google-photos-picker: Google Picker (Mikael Finstad / #5443)
- @uppy/aws-s3: console.error instead of throw for missing etag (Merlijn Vos / #5521)
- docs: Put docs back in uppy.io repository where they belong (Merlijn Vos / #5527)
- docs: typo (Azhar Rizqullah / #5523)
- @uppy/audio,@uppy/aws-s3,@uppy/box,@uppy/companion-client,@uppy/compressor,@uppy/core,@uppy/dashboard,@uppy/drag-drop,@uppy/drop-target,@uppy/dropbox,@uppy/facebook,@uppy/file-input,@uppy/form,@uppy/golden-retriever,@uppy/google-drive,@uppy/google-photos,@uppy/image-editor,@uppy/informer,@uppy/instagram,@uppy/locales,@uppy/onedrive,@uppy/progress-bar,@uppy/provider-views,@uppy/react,@uppy/remote-sources,@uppy/screen-capture,@uppy/status-bar,@uppy/store-default,@uppy/thumbnail-generator,@uppy/transloadit,@uppy/tus,@uppy/unsplash,@uppy/url,@uppy/utils,@uppy/vue,@uppy/webcam,@uppy/xhr-upload,@uppy/zoom: cleanup tsconfig (Mikael Finstad / #5520)
- meta: fix missing lint (Mikael Finstad / #5519)
- docs: Add Next.js docs (Merlijn Vos / #5502)
- e2e: try to fix flaky test (Mikael Finstad / #5512)
- meta: Fix broken lint on CI (Mikael Finstad / #5507)
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.

2 participants