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

fix: remove setInterval from the presets #1035

Merged
merged 1 commit into from
Dec 7, 2024
Merged

Conversation

wattanx
Copy link
Collaborator

@wattanx wattanx commented Dec 7, 2024

πŸ”— Linked issue

Fixes: #897

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

The setInterval overridden by Nuxt is auto-imported, so it can no longer be mocked with useFakeTimers.
(setInterval = window.setInterval, but the previous state is retained.)

I think updating the documentation with a method like separating workspaces as shown below is one possible approach, but which would be more appropriate?
https://stackblitz.com/edit/github-agxb9y-slbn4d

@wattanx wattanx requested a review from danielroe as a code owner December 7, 2024 05:59
Copy link
Member

@danielroe danielroe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you!

should we do this for any of the other polyfills nuxt imports, perhaps?

@danielroe danielroe merged commit 6050ec9 into main Dec 7, 2024
4 checks passed
@danielroe danielroe deleted the fix/fix-set-interval branch December 7, 2024 20:09
@github-actions github-actions bot mentioned this pull request Dec 7, 2024
@wattanx
Copy link
Collaborator Author

wattanx commented Dec 8, 2024

Yes, that's correct. requestIdleCallback seems to have similar issues as setInterval.
Adding an option to exclude specific polyfills could be a good approachβ€”for example, something like imports.polyfills. What do you think?

@danielroe
Copy link
Member

maybe!

certainly we can avoid the interval polyfill on client side

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.

useFakeTimers isn't working for the setInterval.
2 participants