@vue/runtime-dom 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.
@@ -3442,14 +3442,9 @@ If this is a native custom element, make sure to exclude it from component resol
3442
3442
  cb = value.handler;
3443
3443
  options = value;
3444
3444
  }
3445
- const cur = currentInstance;
3446
- setCurrentInstance(this);
3445
+ const reset = setCurrentInstance(this);
3447
3446
  const res = doWatch(getter, cb.bind(publicThis), options);
3448
- if (cur) {
3449
- setCurrentInstance(cur);
3450
- } else {
3451
- unsetCurrentInstance();
3452
- }
3447
+ reset();
3453
3448
  return res;
3454
3449
  }
3455
3450
  function createPathGetter(ctx, path) {
@@ -3501,12 +3496,11 @@ If this is a native custom element, make sure to exclude it from component resol
3501
3496
  }
3502
3497
  }
3503
3498
  function withDirectives(vnode, directives) {
3504
- const internalInstance = currentRenderingInstance;
3505
- if (internalInstance === null) {
3499
+ if (currentRenderingInstance === null) {
3506
3500
  warn$1(`withDirectives can only be used inside render functions.`);
3507
3501
  return vnode;
3508
3502
  }
3509
- const instance = getExposeProxy(internalInstance) || internalInstance.proxy;
3503
+ const instance = getExposeProxy(currentRenderingInstance) || currentRenderingInstance.proxy;
3510
3504
  const bindings = vnode.dirs || (vnode.dirs = []);
3511
3505
  for (let i = 0; i < directives.length; i++) {
3512
3506
  let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i];
@@ -4286,9 +4280,9 @@ If this is a native custom element, make sure to exclude it from component resol
4286
4280
  return;
4287
4281
  }
4288
4282
  pauseTracking();
4289
- setCurrentInstance(target);
4283
+ const reset = setCurrentInstance(target);
4290
4284
  const res = callWithAsyncErrorHandling(hook, target, type, args);
4291
- unsetCurrentInstance();
4285
+ reset();
4292
4286
  resetTracking();
4293
4287
  return res;
4294
4288
  });
@@ -5673,12 +5667,12 @@ If you want to remount the same app, move your app creation logic into a factory
5673
5667
  if (key in propsDefaults) {
5674
5668
  value = propsDefaults[key];
5675
5669
  } else {
5676
- setCurrentInstance(instance);
5670
+ const reset = setCurrentInstance(instance);
5677
5671
  value = propsDefaults[key] = defaultValue.call(
5678
5672
  null,
5679
5673
  props
5680
5674
  );
5681
- unsetCurrentInstance();
5675
+ reset();
5682
5676
  }
5683
5677
  } else {
5684
5678
  value = defaultValue;
@@ -8925,14 +8919,7 @@ Component that was made reactive: `,
8925
8919
  return instance;
8926
8920
  }
8927
8921
  let currentInstance = null;
8928
- const getCurrentInstance = () => {
8929
- if (isInComputedGetter) {
8930
- warn$1(
8931
- `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.`
8932
- );
8933
- }
8934
- return currentInstance || currentRenderingInstance;
8935
- };
8922
+ const getCurrentInstance = () => currentInstance || currentRenderingInstance;
8936
8923
  let internalSetCurrentInstance;
8937
8924
  let setInSSRSetupState;
8938
8925
  {
@@ -8944,8 +8931,13 @@ Component that was made reactive: `,
8944
8931
  };
8945
8932
  }
8946
8933
  const setCurrentInstance = (instance) => {
8934
+ const prev = currentInstance;
8947
8935
  internalSetCurrentInstance(instance);
8948
8936
  instance.scope.on();
8937
+ return () => {
8938
+ instance.scope.off();
8939
+ internalSetCurrentInstance(prev);
8940
+ };
8949
8941
  };
8950
8942
  const unsetCurrentInstance = () => {
8951
8943
  currentInstance && currentInstance.scope.off();
@@ -9007,7 +8999,7 @@ Component that was made reactive: `,
9007
8999
  const { setup } = Component;
9008
9000
  if (setup) {
9009
9001
  const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null;
9010
- setCurrentInstance(instance);
9002
+ const reset = setCurrentInstance(instance);
9011
9003
  pauseTracking();
9012
9004
  const setupResult = callWithErrorHandling(
9013
9005
  setup,
@@ -9019,7 +9011,7 @@ Component that was made reactive: `,
9019
9011
  ]
9020
9012
  );
9021
9013
  resetTracking();
9022
- unsetCurrentInstance();
9014
+ reset();
9023
9015
  if (isPromise(setupResult)) {
9024
9016
  setupResult.then(unsetCurrentInstance, unsetCurrentInstance);
9025
9017
  if (isSSR) {
@@ -9113,13 +9105,13 @@ Component that was made reactive: `,
9113
9105
  }
9114
9106
  }
9115
9107
  {
9116
- setCurrentInstance(instance);
9108
+ const reset = setCurrentInstance(instance);
9117
9109
  pauseTracking();
9118
9110
  try {
9119
9111
  applyOptions(instance);
9120
9112
  } finally {
9121
9113
  resetTracking();
9122
- unsetCurrentInstance();
9114
+ reset();
9123
9115
  }
9124
9116
  }
9125
9117
  if (!Component.render && instance.render === NOOP && !isSSR) {
@@ -9246,25 +9238,7 @@ Component that was made reactive: `,
9246
9238
  return isFunction(value) && "__vccOpts" in value;
9247
9239
  }
9248
9240
 
9249
- let isInComputedGetter = false;
9250
- function wrapComputedGetter(getter) {
9251
- return () => {
9252
- isInComputedGetter = true;
9253
- try {
9254
- return getter();
9255
- } finally {
9256
- isInComputedGetter = false;
9257
- }
9258
- };
9259
- }
9260
9241
  const computed = (getterOrOptions, debugOptions) => {
9261
- {
9262
- if (isFunction(getterOrOptions)) {
9263
- getterOrOptions = wrapComputedGetter(getterOrOptions);
9264
- } else {
9265
- getterOrOptions.get = wrapComputedGetter(getterOrOptions.get);
9266
- }
9267
- }
9268
9242
  return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
9269
9243
  };
9270
9244
 
@@ -9490,7 +9464,7 @@ Component that was made reactive: `,
9490
9464
  return true;
9491
9465
  }
9492
9466
 
9493
- const version = "3.4.6";
9467
+ const version = "3.4.7";
9494
9468
  const warn = warn$1 ;
9495
9469
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
9496
9470
  const devtools = devtools$1 ;