@@ -78,12 +78,12 @@ export function mutate(source, value) {
78
78
79
79
/**
80
80
* @template V
81
- * @param {import('#client').Source<V> } signal
81
+ * @param {import('#client').Source<V> } source
82
82
* @param {V } value
83
83
* @returns {V }
84
84
*/
85
- export function set ( signal , value ) {
86
- var initialized = signal . v !== UNINITIALIZED ;
85
+ export function set ( source , value ) {
86
+ var initialized = source . v !== UNINITIALIZED ;
87
87
88
88
if (
89
89
initialized &&
@@ -94,11 +94,11 @@ export function set(signal, value) {
94
94
e . state_unsafe_mutation ( ) ;
95
95
}
96
96
97
- if ( ! signal . equals ( value ) ) {
98
- signal . v = value ;
97
+ if ( ! source . equals ( value ) ) {
98
+ source . v = value ;
99
+ source . version = increment_version ( ) ;
99
100
100
- // Increment write version so that unowned signals can properly track dirtiness
101
- signal . version = increment_version ( ) ;
101
+ mark_reactions ( source , DIRTY , true ) ;
102
102
103
103
// If the current signal is running for the first time, it won't have any
104
104
// reactions as we only allocate and assign the reactions after the signal
@@ -116,25 +116,23 @@ export function set(signal, value) {
116
116
( current_effect . f & CLEAN ) !== 0 &&
117
117
( current_effect . f & BRANCH_EFFECT ) === 0
118
118
) {
119
- if ( current_dependencies !== null && current_dependencies . includes ( signal ) ) {
119
+ if ( current_dependencies !== null && current_dependencies . includes ( source ) ) {
120
120
set_signal_status ( current_effect , DIRTY ) ;
121
121
schedule_effect ( current_effect ) ;
122
122
} else {
123
123
if ( current_untracked_writes === null ) {
124
- set_current_untracked_writes ( [ signal ] ) ;
124
+ set_current_untracked_writes ( [ source ] ) ;
125
125
} else {
126
- current_untracked_writes . push ( signal ) ;
126
+ current_untracked_writes . push ( source ) ;
127
127
}
128
128
}
129
129
}
130
130
131
- mark_reactions ( signal , DIRTY , true ) ;
132
-
133
131
if ( DEV ) {
134
132
if ( is_batching_effect ) {
135
- set_last_inspected_signal ( /** @type {import('#client').ValueDebug } */ ( signal ) ) ;
133
+ set_last_inspected_signal ( /** @type {import('#client').ValueDebug } */ ( source ) ) ;
136
134
} else {
137
- for ( const fn of /** @type {import('#client').ValueDebug } */ ( signal ) . inspect ) fn ( ) ;
135
+ for ( const fn of /** @type {import('#client').ValueDebug } */ ( source ) . inspect ) fn ( ) ;
138
136
}
139
137
}
140
138
}
0 commit comments