-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
add Promise/setTimeout/setInterval
to GLOBALS_ALLOWED
#13442
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
base: main
Are you sure you want to change the base?
Conversation
WalkthroughThe global allow list in the codebase has been updated to include Changes
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (4)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Size ReportBundles
Usages
|
@vue/compiler-core
@vue/compiler-dom
@vue/compiler-sfc
@vue/compiler-ssr
@vue/reactivity
@vue/runtime-core
@vue/runtime-dom
@vue/server-renderer
@vue/shared
vue
@vue/compat
commit: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
packages/shared/src/globalsAllowList.ts (1)
3-7
: Consider refactoring to an array join for maintainabilityManaging a long, multi-line comma-separated string is prone to delimiter mistakes. Converting the list into an array and using
.join(',')
would improve readability and reduce such errors.Example:
const GLOBALS_ALLOWED = [ 'Infinity', 'undefined', 'NaN', 'isFinite', 'isNaN', 'parseFloat', 'parseInt', 'decodeURI', 'decodeURIComponent', 'encodeURI', 'encodeURIComponent', 'Math', 'Number', 'Date', 'Array', 'Object', 'Boolean', 'String', 'RegExp', 'Map', 'Set', 'JSON', 'Intl', 'BigInt', 'console', 'Error', 'Symbol', 'Promise', 'setTimeout', 'setInterval' ].join(',');
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/shared/src/globalsAllowList.ts
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (9)
- GitHub Check: upload
- GitHub Check: autofix
- GitHub Check: test / e2e-test
- GitHub Check: test / lint-and-test-dts
- GitHub Check: test / unit-test
- GitHub Check: continuous-release
- GitHub Check: Redirect rules
- GitHub Check: Header rules
- GitHub Check: Pages changed
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
both setTimeout and setInterval are not standard built-in objects |
Inline handlers are only meant to be used for simple code (https://vuejs.org/guide/essentials/event-handling.html), which is why the list of allowed globals is quite small. The correct approach would be to have function in <script setup> with that code inside of it, which you then reference in the template. e.g. <script setup lang="ts">
async function handleClick() {
doSomething()
await Promise(r => setTimeout(r, 1000))
doSomething()
}
</script>
<template>
<div @click="handleClick">loading</div>
</template> |
|
See #7939 (comment). |
This scene was discovered when I temporarily wanted to debug some information
current i have to
Summary by CodeRabbit
Summary by CodeRabbit
Promise
,setTimeout
, andsetInterval
.