Content-Length: 320808 | pFad | http://github.com/sveltejs/svelte/pull/16140/commits/642105f6efd2df45c1b470113e7d9d1181c6daed

63 fix: ensure #if blocks correctly guard against nullable prop values by rChaoz · Pull Request #16140 · sveltejs/svelte · GitHub
Skip to content

fix: ensure #if blocks correctly guard against nullable prop values #16140

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from
Prev Previous commit
Next Next commit
Make it work with out transitions
  • Loading branch information
rChaoz committed Jun 12, 2025
commit 642105f6efd2df45c1b470113e7d9d1181c6daed
25 changes: 20 additions & 5 deletions packages/svelte/src/internal/client/reactivity/props.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ import {
import { get_descriptor, is_function } from '../../shared/utils.js';
import { mutable_source, set, source, update } from './sources.js';
import { derived, derived_safe_equal } from './deriveds.js';
import { get, captured_signals, untrack } from '../runtime.js';
import { get, captured_signals, untrack, active_effect } from '../runtime.js';
import { safe_equals } from './equality.js';
import * as e from '../errors.js';
import { LEGACY_DERIVED_PROP, LEGACY_PROPS, STATE_SYMBOL } from '#client/constants';
import { proxy } from '../proxy.js';
import { capture_store_binding } from './store.js';
import { legacy_mode_flag } from '../../flags/index.js';
import { teardown } from './effects.js';
import { component_context } from '../context.js';

/**
* @param {((value?: number) => number)} fn
Expand Down Expand Up @@ -240,8 +240,23 @@ const spread_props_handler = {
* @returns {any}
*/
export function props(...props) {
let destroyed = false;
teardown(() => (destroyed = true));
let paused = false;
const context = component_context;
if (active_effect) {
(active_effect.transitions ??= []).push({
is_global: true,
in() {
paused = false;
},
out(callback) {
paused = true;
callback?.();
},
stop() {
paused = true;
}
});
}
return new Proxy(
{
props,
Expand All @@ -254,7 +269,7 @@ export function props(...props) {
return oldProps;
}),
get destroyed() {
return destroyed;
return (context?.d ?? false) || paused;
}
},
spread_props_handler
Expand Down








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/sveltejs/svelte/pull/16140/commits/642105f6efd2df45c1b470113e7d9d1181c6daed

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy