vue 3.4.6 → 3.4.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3507,14 +3507,9 @@ If this is a native custom element, make sure to exclude it from component resol
3507
3507
  cb = value.handler;
3508
3508
  options = value;
3509
3509
  }
3510
- const cur = currentInstance;
3511
- setCurrentInstance(this);
3510
+ const reset = setCurrentInstance(this);
3512
3511
  const res = doWatch(getter, cb.bind(publicThis), options);
3513
- if (cur) {
3514
- setCurrentInstance(cur);
3515
- } else {
3516
- unsetCurrentInstance();
3517
- }
3512
+ reset();
3518
3513
  return res;
3519
3514
  }
3520
3515
  function createPathGetter(ctx, path) {
@@ -3566,12 +3561,11 @@ If this is a native custom element, make sure to exclude it from component resol
3566
3561
  }
3567
3562
  }
3568
3563
  function withDirectives(vnode, directives) {
3569
- const internalInstance = currentRenderingInstance;
3570
- if (internalInstance === null) {
3564
+ if (currentRenderingInstance === null) {
3571
3565
  warn$1(`withDirectives can only be used inside render functions.`);
3572
3566
  return vnode;
3573
3567
  }
3574
- const instance = getExposeProxy(internalInstance) || internalInstance.proxy;
3568
+ const instance = getExposeProxy(currentRenderingInstance) || currentRenderingInstance.proxy;
3575
3569
  const bindings = vnode.dirs || (vnode.dirs = []);
3576
3570
  for (let i = 0; i < directives.length; i++) {
3577
3571
  let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
@@ -4351,9 +4345,9 @@ If this is a native custom element, make sure to exclude it from component resol
4351
4345
  return;
4352
4346
  }
4353
4347
  pauseTracking();
4354
- setCurrentInstance(target);
4348
+ const reset = setCurrentInstance(target);
4355
4349
  const res = callWithAsyncErrorHandling(hook, target, type, args);
4356
- unsetCurrentInstance();
4350
+ reset();
4357
4351
  resetTracking();
4358
4352
  return res;
4359
4353
  });
@@ -5738,12 +5732,12 @@ If you want to remount the same app, move your app creation logic into a factory
5738
5732
  if (key in propsDefaults) {
5739
5733
  value = propsDefaults[key];
5740
5734
  } else {
5741
- setCurrentInstance(instance);
5735
+ const reset = setCurrentInstance(instance);
5742
5736
  value = propsDefaults[key] = defaultValue.call(
5743
5737
  null,
5744
5738
  props
5745
5739
  );
5746
- unsetCurrentInstance();
5740
+ reset();
5747
5741
  }
5748
5742
  } else {
5749
5743
  value = defaultValue;
@@ -8990,14 +8984,7 @@ Component that was made reactive: `,
8990
8984
  return instance;
8991
8985
  }
8992
8986
  let currentInstance = null;
8993
- const getCurrentInstance = () => {
8994
- if (isInComputedGetter) {
8995
- warn$1(
8996
- `getCurrentInstance() called inside a computed getter. This is incorrect usage as computed getters are not guaranteed to be executed with an active component instance. If you are using a composable inside a computed getter, move it ouside to the setup scope.`
8997
- );
8998
- }
8999
- return currentInstance || currentRenderingInstance;
9000
- };
8987
+ const getCurrentInstance = () => currentInstance || currentRenderingInstance;
9001
8988
  let internalSetCurrentInstance;
9002
8989
  let setInSSRSetupState;
9003
8990
  {
@@ -9009,8 +8996,13 @@ Component that was made reactive: `,
9009
8996
  };
9010
8997
  }
9011
8998
  const setCurrentInstance = (instance) => {
8999
+ const prev = currentInstance;
9012
9000
  internalSetCurrentInstance(instance);
9013
9001
  instance.scope.on();
9002
+ return () => {
9003
+ instance.scope.off();
9004
+ internalSetCurrentInstance(prev);
9005
+ };
9014
9006
  };
9015
9007
  const unsetCurrentInstance = () => {
9016
9008
  currentInstance && currentInstance.scope.off();
@@ -9072,7 +9064,7 @@ Component that was made reactive: `,
9072
9064
  const { setup } = Component;
9073
9065
  if (setup) {
9074
9066
  const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
9075
- setCurrentInstance(instance);
9067
+ const reset = setCurrentInstance(instance);
9076
9068
  pauseTracking();
9077
9069
  const setupResult = callWithErrorHandling(
9078
9070
  setup,
@@ -9084,7 +9076,7 @@ Component that was made reactive: `,
9084
9076
  ]
9085
9077
  );
9086
9078
  resetTracking();
9087
- unsetCurrentInstance();
9079
+ reset();
9088
9080
  if (isPromise(setupResult)) {
9089
9081
  setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
9090
9082
  if (isSSR) {
@@ -9178,13 +9170,13 @@ Component that was made reactive: `,
9178
9170
  }
9179
9171
  }
9180
9172
  {
9181
- setCurrentInstance(instance);
9173
+ const reset = setCurrentInstance(instance);
9182
9174
  pauseTracking();
9183
9175
  try {
9184
9176
  applyOptions(instance);
9185
9177
  } finally {
9186
9178
  resetTracking();
9187
- unsetCurrentInstance();
9179
+ reset();
9188
9180
  }
9189
9181
  }
9190
9182
  if (!Component.render && instance.render === NOOP && !isSSR) {
@@ -9311,25 +9303,7 @@ Component that was made reactive: `,
9311
9303
  return isFunction(value) && "__vccOpts" in value;
9312
9304
  }
9313
9305
 
9314
- let isInComputedGetter = false;
9315
- function wrapComputedGetter(getter) {
9316
- return () => {
9317
- isInComputedGetter = true;
9318
- try {
9319
- return getter();
9320
- } finally {
9321
- isInComputedGetter = false;
9322
- }
9323
- };
9324
- }
9325
9306
  const computed = (getterOrOptions, debugOptions) => {
9326
- {
9327
- if (isFunction(getterOrOptions)) {
9328
- getterOrOptions = wrapComputedGetter(getterOrOptions);
9329
- } else {
9330
- getterOrOptions.get = wrapComputedGetter(getterOrOptions.get);
9331
- }
9332
- }
9333
9307
  return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
9334
9308
  };
9335
9309
 
@@ -9555,7 +9529,7 @@ Component that was made reactive: `,
9555
9529
  return true;
9556
9530
  }
9557
9531
 
9558
- const version = "3.4.6";
9532
+ const version = "3.4.7";
9559
9533
  const warn = warn$1 ;
9560
9534
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
9561
9535
  const devtools = devtools$1 ;
@@ -13453,8 +13427,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
13453
13427
  }
13454
13428
  context.parent.children.splice(removalIndex, 1);
13455
13429
  },
13456
- onNodeRemoved: () => {
13457
- },
13430
+ onNodeRemoved: NOOP,
13458
13431
  addIdentifiers(exp) {
13459
13432
  },
13460
13433
  removeIdentifiers(exp) {