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

allow opting out from events timestamp check (fix #2513, #3933) #5474

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/runtime-core/src/apiCreateApp.ts
Expand Up @@ -81,6 +81,7 @@ export interface AppConfig {
instance: ComponentPublicInstance | null,
trace: string
) => void
skipEventsTimestampCheck: boolean

/**
* Options to pass to `@vue/compiler-dom`.
Expand Down Expand Up @@ -155,7 +156,8 @@ export function createAppContext(): AppContext {
optionMergeStrategies: {},
errorHandler: undefined,
warnHandler: undefined,
compilerOptions: {}
compilerOptions: {},
skipEventsTimestampCheck: false
},
mixins: [],
components: {},
Expand Down
5 changes: 4 additions & 1 deletion packages/runtime-dom/src/modules/events.ts
Expand Up @@ -118,7 +118,10 @@ function createInvoker(
// AFTER it was attached.
const timeStamp = e.timeStamp || _getNow()

if (skipTimestampCheck || timeStamp >= invoker.attached - 1) {
// Skip the timestamp check if the skipEventsTimestampCheck app config is set to true.
const appSkipTimestampCheck = instance?.appContext?.config.skipEventsTimestampCheck === true

if (appSkipTimestampCheck || skipTimestampCheck || timeStamp >= invoker.attached - 1) {
callWithAsyncErrorHandling(
patchStopImmediatePropagation(e, invoker.value),
instance,
Expand Down