Skip to content

Commit

Permalink
fix(runtime-dom): allow opting out from events timestamp check
Browse files Browse the repository at this point in the history
close #2513 #3933
  • Loading branch information
semiaddict committed Feb 23, 2022
1 parent 5898629 commit 42942fb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion packages/runtime-core/src/apiCreateApp.ts
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,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

0 comments on commit 42942fb

Please sign in to comment.