Skip to content

Commit 42942fb

Browse files
committed
fix(runtime-dom): allow opting out from events timestamp check
close #2513 #3933
1 parent 5898629 commit 42942fb

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

packages/runtime-core/src/apiCreateApp.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ export interface AppConfig {
8181
instance: ComponentPublicInstance | null,
8282
trace: string
8383
) => void
84+
skipEventsTimestampCheck: boolean
8485

8586
/**
8687
* Options to pass to `@vue/compiler-dom`.
@@ -155,7 +156,8 @@ export function createAppContext(): AppContext {
155156
optionMergeStrategies: {},
156157
errorHandler: undefined,
157158
warnHandler: undefined,
158-
compilerOptions: {}
159+
compilerOptions: {},
160+
skipEventsTimestampCheck: false
159161
},
160162
mixins: [],
161163
components: {},

packages/runtime-dom/src/modules/events.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,10 @@ function createInvoker(
117117
// AFTER it was attached.
118118
const timeStamp = e.timeStamp || _getNow()
119119

120-
if (skipTimestampCheck || timeStamp >= invoker.attached - 1) {
120+
// Skip the timestamp check if the skipEventsTimestampCheck app config is set to true.
121+
const appSkipTimestampCheck = instance?.appContext?.config.skipEventsTimestampCheck === true
122+
123+
if (appSkipTimestampCheck || skipTimestampCheck || timeStamp >= invoker.attached - 1) {
121124
callWithAsyncErrorHandling(
122125
patchStopImmediatePropagation(e, invoker.value),
123126
instance,

0 commit comments

Comments
 (0)