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

Tooltip - AbortController is not defined in SSR mode (Nuxt) #4017

Closed
mirocklez opened this issue Feb 29, 2024 · 3 comments · Fixed by #4019
Closed

Tooltip - AbortController is not defined in SSR mode (Nuxt) #4017

mirocklez opened this issue Feb 29, 2024 · 3 comments · Fixed by #4019
Assignees
Labels

Comments

@mirocklez
Copy link

mirocklez commented Feb 29, 2024

Buefy version: [0.9.28]
Nuxt version: [2.17.3]

Description

In the last update of the Tooltip component - there is an addon to remove animation on beforeDestroy event.
The problem is that it is using window.AbortController() without checking are window and/or AbortController defined.
Both of them are not defined when using Nuxt with SSR mode.

Code source

this.controller = new window.AbortController()

this.controller.abort()

First - when AbortController is registered (row 288) in SSR mode it will be just undefined.
Second - when using the abort method (row 334) without checking it is defined - is causing the error:

TypeError
Cannot read property 'abort' of undefined

Expected behavior

Use AbortController only after check if window and/or AbortController are defined.

Actual behavior

AbortController is used without checking for window object and/or AbortController instance which cause errors.

@mirocklez mirocklez changed the title Tooltip - AbortController in SSR (Nuxt) Tooltip - AbortController is not defined in SSR mode (Nuxt) Feb 29, 2024
@mirocklez mirocklez changed the title Tooltip - AbortController is not defined in SSR mode (Nuxt) Tooltip - AbortController is not defined in SSR mode (Nuxt) Feb 29, 2024
@kikuomax kikuomax added the bug label Feb 29, 2024
@IvayloWogi
Copy link

I have the same problem in my project.

@kikuomax
Copy link
Collaborator

kikuomax commented Mar 4, 2024

@miroslavgeorgiev Thanks for reporting an issue. Could you do me a favor; locally build and test if fix-window-abort-controller branch resolves the problem? As I am not actively using Nuxt, I do not have an environment where I can quickly test it with Nuxt 2.

FYI: building fix-window-abort-controller branch:

git fetch https://github.com/buefy/buefy.git fix-window-abort-controller
git checkout FETCH_HEAD
npm ci
npm run build

@mirocklez
Copy link
Author

Sure - checking the PR :)

kikuomax added a commit that referenced this issue Mar 6, 2024
…) (#4019)

* fix: Tooltip did not work in SSR due to AbortController

Fixes the bug that `Tooltip` did not work in Server Side Rendering
(SSR) due to `window.AbortController` use; i.e., no `window` is
available in SSR. Moves `window.AbortController` access inside the
`window` availability check.

* docs: update CHANGELOG

Adds unreleased entry for v0.9.29.
Lists the fix of the `window.AbortController` use in SSR.
kikuomax added a commit to kikuomax/buefy that referenced this issue Apr 2, 2024
…fy#4017) (buefy#4019)

* fix: Tooltip did not work in SSR due to AbortController

Fixes the bug that `Tooltip` did not work in Server Side Rendering
(SSR) due to `window.AbortController` use; i.e., no `window` is
available in SSR. Moves `window.AbortController` access inside the
`window` availability check.

* docs: update CHANGELOG

Adds unreleased entry for v0.9.29.
Lists the fix of the `window.AbortController` use in SSR.
kikuomax added a commit to ntohq/buefy-next that referenced this issue Apr 3, 2024
…fy#4017) (buefy#4019)

* fix: Tooltip did not work in SSR due to AbortController

Fixes the bug that `Tooltip` did not work in Server Side Rendering
(SSR) due to `window.AbortController` use; i.e., no `window` is
available in SSR. Moves `window.AbortController` access inside the
`window` availability check.

* docs: update CHANGELOG

Adds unreleased entry for v0.9.29.
Lists the fix of the `window.AbortController` use in SSR.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Pending Release🔦
Development

Successfully merging a pull request may close this issue.

3 participants