You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/svelte/src/internal/client/errors.js
+16Lines changed: 16 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -310,6 +310,22 @@ export function state_prototype_fixed() {
310
310
}
311
311
}
312
312
313
+
/**
314
+
* Reading state that was created inside the same derived is forbidden. Consider using `untrack` to read locally created state
315
+
* @returns {never}
316
+
*/
317
+
exportfunctionstate_unsafe_local_read(){
318
+
if(DEV){
319
+
consterror=newError(`state_unsafe_local_read\nReading state that was created inside the same derived is forbidden. Consider using \`untrack\` to read locally created state`);
320
+
321
+
error.name='Svelte error';
322
+
throwerror;
323
+
}else{
324
+
// TODO print a link to the documentation
325
+
thrownewError("state_unsafe_local_read");
326
+
}
327
+
}
328
+
313
329
/**
314
330
* Updating state inside a derived is forbidden. If the value should not be reactive, declare it without `$state`
0 commit comments