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

Uncaught (in promise) Error: Filestack Picker Initialize Error in Console After Upload #113

Open
hamideha opened this issue Apr 5, 2021 · 8 comments

Comments

@hamideha
Copy link

hamideha commented Apr 5, 2021

I'm using Filestack in my react app (17.0.2) and whenever I press upload on the picker I get this error in the console. The upload is working correctly and I'm getting the right result back from the onSuccess prop but I don't know if this error is caused by my app.

Screenshot 2021-04-04 221036

@hamideha hamideha closed this as completed Apr 5, 2021
@hamideha hamideha reopened this Apr 5, 2021
@hamideha hamideha closed this as completed Apr 5, 2021
@a-martins
Copy link

Hey man, Do you solved this issue? If yes, what did you do?

@hamideha
Copy link
Author

Hey man, Do you solved this issue? If yes, what did you do?

No, sorry about that. I ended up using a completely different library.

@a-martins
Copy link

Hey man, Do you solved this issue? If yes, what did you do?

No, sorry about that. I ended up using a completely different library.

Could you please re-open this issue to avoid duplicate issues?
This is happening with me too and I didn't find anything helpful yet.

@hamideha hamideha reopened this Apr 29, 2021
@konradkrk
Copy link
Contributor

@a-martins I can't reproduce this bug, please send yours sample code.

@a-martins
Copy link

@noire-munich
Copy link

I have the same issue but on render. Here's my code:

import { PickerInline } from 'filestack-react'
import useUploader from 'src/ui/File/useUploader'
import './Stage.scss'

const Stage = ({ component: Component, name }) => {
  const { errors, onUploadDone, files } = useUploader({ name })

  return (
    <div className="flex w-full flex-col justify-center border-[1px] bg-white p-4 align-middle md:flex-row">
      <Component name={name} files={files} />
      <div className="mt-4 flex w-full shrink md:mt-0 md:ml-4 md:w-96">
        <PickerInline
          apikey={xxx}
          onUploadDone={onUploadDone}
          pickerOptions={{
            displayMode: 'inline',
            disableTransformer: true,
            fromSources: ['local_file_system', 'googledrive', 'url', 'gmail'],
            viewType: 'grid',
          }}
        >
          <div className="guaranteed-flexible-height"></div>
        </PickerInline>
      </div>
      {errors && <div>Errors!</div>}
    </div>
  )
}

export default React.memo(Stage)

I've tried any sort of modifications in here and nothing worked.
At some point way earlier on in my dev, I had a version without the error, but I can't go back to that point for some reason. To the best of my recollection it was linked to a hook or a React.memo.

@noire-munich
Copy link

Ok, just got it... ><.

My component is wrapped in a HOC, that HOC calls a redux-toolkit Provider with a store: it let's me handle a preview display.

So those two libs together raise that error in the console. At least that's the issue for me.

@harelcoman
Copy link

It seems we render the component before it properly initializes.
Adding a timeout helped with that.
I suggest if not already exist extracting a variable isIntialize so we can check this and not a random timeout.

   useEffect(() => {
        const timer = setTimeout(() => {
            setShouldRenderPicker(true)
        }, 600)

        return () => clearTimeout(timer)
    }, [])

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

No branches or pull requests

5 participants