Skip to content

Commit 1d9bb38

Browse files
committed
maint(core base): Document prevention of pattern double initialization in asynchronous cases.
1 parent 2015e89 commit 1d9bb38

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/core/base.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ const initBasePattern = function ($el, options, trigger) {
2727
let pattern = $el.data(`pattern-${name}`);
2828
if (pattern === undefined && Registry.patterns[name]) {
2929
try {
30+
// Immediately set the pattern instance to the temporary value
31+
// ``initializing`` before the async Base constructor is setting
32+
// the value later.
33+
// This prevents re-init the pattern on this element on multiple
34+
// initialization calls..
3035
$el.data(`pattern-${name}`, "initializing");
3136
options =
3237
this.prototype.parser === "mockup"

0 commit comments

Comments
 (0)