svelte
Advanced tools
Comparing version 5.0.0-next.77 to 5.0.0-next.78
@@ -5,3 +5,3 @@ { | ||
"license": "MIT", | ||
"version": "5.0.0-next.77", | ||
"version": "5.0.0-next.78", | ||
"type": "module", | ||
@@ -8,0 +8,0 @@ "types": "./types/index.d.ts", |
@@ -11,3 +11,2 @@ import { DEV } from 'esm-env'; | ||
get, | ||
ignore_mutation_validation, | ||
is_batching_effect, | ||
@@ -23,3 +22,3 @@ is_runes, | ||
import { equals, safe_equals } from './equality.js'; | ||
import { CLEAN, DERIVED, DIRTY, MANAGED } from '../constants.js'; | ||
import { CLEAN, DERIVED, DIRTY, MANAGED, UNINITIALIZED } from '../constants.js'; | ||
@@ -98,5 +97,7 @@ /** | ||
export function set(signal, value) { | ||
var initialized = signal.v !== UNINITIALIZED; | ||
if ( | ||
!current_untracking && | ||
!ignore_mutation_validation && | ||
initialized && | ||
current_reaction !== null && | ||
@@ -130,7 +131,6 @@ is_runes() && | ||
// | ||
// We additionally want to skip this logic for when ignore_mutation_validation is | ||
// true, as stores write to source signal on initialisation. | ||
// We additionally want to skip this logic when initialising store sources | ||
if ( | ||
is_runes() && | ||
!ignore_mutation_validation && | ||
initialized && | ||
current_effect !== null && | ||
@@ -137,0 +137,0 @@ (current_effect.f & CLEAN) !== 0 && |
import { subscribe_to_store } from '../../../store/utils.js'; | ||
import { noop } from '../../common.js'; | ||
import { UNINITIALIZED } from '../constants.js'; | ||
import { get, set_ignore_mutation_validation, untrack } from '../runtime.js'; | ||
import { get, untrack } from '../runtime.js'; | ||
import { user_effect } from './effects.js'; | ||
@@ -77,9 +77,3 @@ import { mutable_source, set } from './sources.js'; | ||
/** @param {V} v */ | ||
const run = (v) => { | ||
set_ignore_mutation_validation(true); | ||
set(source, v); | ||
set_ignore_mutation_validation(false); | ||
}; | ||
return subscribe_to_store(store, run); | ||
return subscribe_to_store(store, (v) => set(source, v)); | ||
} | ||
@@ -100,2 +94,13 @@ | ||
/** | ||
* @param {import('#client').StoreReferencesContainer} stores | ||
* @param {string} store_name | ||
*/ | ||
export function invalidate_store(stores, store_name) { | ||
const store = stores[store_name]; | ||
if (store.store) { | ||
store_set(store.store, store.value.v); | ||
} | ||
} | ||
/** | ||
* Unsubscribes from all auto-subscribed stores on destroy | ||
@@ -102,0 +107,0 @@ * @param {import('#client').StoreReferencesContainer} stores |
@@ -87,8 +87,2 @@ import { DEV } from 'esm-env'; | ||
export let current_untracking = false; | ||
/** Exists to opt out of the mutation validation for stores which may be set for the first time during a derivation */ | ||
export let ignore_mutation_validation = false; | ||
/** @param {boolean} value */ | ||
export function set_ignore_mutation_validation(value) { | ||
ignore_mutation_validation = value; | ||
} | ||
@@ -95,0 +89,0 @@ // If we are working with a get() chain that has no active container, |
@@ -85,7 +85,8 @@ import { DEV } from 'esm-env'; | ||
var source = this.#sources.get(value); | ||
// We should always track the version in case | ||
// the Set ever gets this value in the future. | ||
get(this.#version); | ||
if (source === undefined) { | ||
// We should always track the version in case | ||
// the Set ever gets this value in the future. | ||
get(this.#version); | ||
return false; | ||
@@ -92,0 +93,0 @@ } |
@@ -9,3 +9,3 @@ // generated during release, do not modify | ||
*/ | ||
export const VERSION = '5.0.0-next.77'; | ||
export const VERSION = '5.0.0-next.78'; | ||
export const PUBLIC_VERSION = '5'; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
1946266
42470