nuxt-modules / cloudinary

Cloudinary Module for Nuxt
https://cloudinary.nuxtjs.org
MIT License
245 stars 31 forks source link

Cannot read properties of undefined (reading 'open') #184

Closed Nixon4056 closed 4 months ago

Nixon4056 commented 5 months ago
<div class="img__container">
          <CldUploadWidget
            v-slot="{ open }"
            uploadPreset="OBM_app"
            @upload="handleUploadClick($event.value.info)"
          >
            <div
              v-if="!editMiner.img"
              @click="open"
              class="add__image d-flex justify-content-center align-items-center"
            >
              <IconCSS
                size="65px"
                name="material-symbols:note-stack-add-outline"
              />
            </div>
            <div class="add__image" v-else>
              <div>
                <CldImage
                  alt="miner-img"
                  @click="open"
                  width="150"
                  height="150"
                  :src="miner?.img || editMiner.img"
                >
                </CldImage>
              </div>
            </div>
          </CldUploadWidget>
        </div>

works only when page is refreshed, otherwise:

Uncaught TypeError: Cannot read properties of undefined (reading 'open')
    at invokeInstanceMethod (CldUploadWidget.vue:160:31)
    at open (CldUploadWidget.vue:192:7)
    at callWithErrorHandling (chunk-RAKT47ZN.js?v=785b1bdf:1565:18)
    at callWithAsyncErrorHandling (chunk-RAKT47ZN.js?v=785b1bdf:1573:17)
    at HTMLImageElement.invoker (chunk-RAKT47ZN.js?v=785b1bdf:9397:5)
Baroshem commented 5 months ago

Hey,

Thanks for reporting this issue. That is strange

I have the following example in the documentation:

  <CldUploadWidget v-slot="{ open }" uploadPreset="nuxt-cloudinary-unsigned">
    <button type="button" class="button" @click="open">Upload an Image</button>
  </CldUploadWidget>

That is used https://cloudinary.nuxtjs.org/components/clduploadwidget and there is no issue like yours.

Could you please create a reproduction link in stackblitz? I will take a look at it then.

Baroshem commented 5 months ago

@Nixon4056

Hey, any news?

Baroshem commented 4 months ago

Closing as there is no further contact.

If the problem will persist, please reopen the issue :)