Skip to content

Commit 37f52a4

Browse files
authored
cleanup
1 parent 0225a9c commit 37f52a4

File tree

4 files changed

+13
-10
lines changed

4 files changed

+13
-10
lines changed

packages/svelte/src/internal/client/runtime.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -897,7 +897,7 @@ export function store_set(store, value) {
897897
* @param {import('./types.js').StoreReferencesContainer} stores
898898
*/
899899
export function unsubscribe_on_destroy(stores) {
900-
onDestroy(() => {
900+
on_destroy(() => {
901901
let store_name;
902902
for (store_name in stores) {
903903
const ref = stores[store_name];
@@ -1859,15 +1859,10 @@ export function value_or_fallback(value, fallback) {
18591859

18601860
/**
18611861
* Schedules a callback to run immediately before the component is unmounted.
1862-
*
1863-
* Out of `onMount`, `beforeUpdate`, `afterUpdate` and `onDestroy`, this is the
1864-
* only one that runs inside a server-side component.
1865-
*
1866-
* https://svelte.dev/docs/svelte#ondestroy
18671862
* @param {() => any} fn
18681863
* @returns {void}
18691864
*/
1870-
export function onDestroy(fn) {
1865+
function on_estroy(fn) {
18711866
user_effect(() => () => untrack(fn));
18721867
}
18731868

@@ -1921,7 +1916,11 @@ export function pop(accessors) {
19211916
}
19221917
}
19231918

1924-
/** @param {import('./types.js').ComponentContext} context */
1919+
/**
1920+
* Invoke the getter of all signals associated with a component
1921+
* so they can be registered to the effect this function is called in.
1922+
* @param {import('./types.js').ComponentContext} context
1923+
*/
19251924
function observe_all(context) {
19261925
if (context.d) {
19271926
for (const signal of context.d) get(signal);
@@ -1933,6 +1932,9 @@ function observe_all(context) {
19331932
}
19341933
}
19351934

1935+
/**
1936+
* Legacy-mode only: Call `onMount` callbacks and set up `beforeUpdate`/`afterUpdate` effects
1937+
*/
19361938
export function init() {
19371939
const context = /** @type {import('./types.js').ComponentContext} */ (current_component_context);
19381940
const callbacks = context.u;

packages/svelte/src/internal/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ export {
3030
exclude_from_object,
3131
store_set,
3232
unsubscribe_on_destroy,
33-
onDestroy,
3433
pop,
3534
push,
3635
reactive_import,

packages/svelte/src/main/main-client.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ export function afterUpdate(fn) {
224224
}
225225

226226
/**
227-
*
227+
* Legacy-mode: Init callbacks object for onMount/beforeUpdate/afterUpdate
228228
* @param {import('../internal/client/types.js').ComponentContext} context
229229
*/
230230
function init_update_callbacks(context) {

packages/svelte/tests/runtime-browser/test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,8 @@ async function run_test(
125125
{
126126
name: 'testing-runtime-browser-ssr',
127127
setup(build) {
128+
// When running the server version of the Svelte files,
129+
// we also want to use the server export of the Svelte package
128130
build.onResolve({ filter: /./ }, (args) => {
129131
if (args.path === 'svelte') {
130132
return { path: ssr_entry };

0 commit comments

Comments
 (0)