remove unused second argument to source, and runtime immutable option to createRoot (not sure what that was doing there?)

proxied-state-each-blocks
Rich Harris 9 months ago
parent 84a30b55cd
commit ccc47a0747

@ -2606,7 +2606,6 @@ export function spread_props(props) {
* events?: Events;
* context?: Map<any, any>;
* intro?: boolean;
* immutable?: boolean;
* recover?: false;
* }} options
* @returns {Exports & { $destroy: () => void; $set: (props: Partial<Props>) => void; }}
@ -2624,15 +2623,8 @@ export function createRoot(component, options) {
* @param {any} value
*/
function add_prop(name, value) {
const prop = source(
value,
options.immutable
? /**
* @param {any} a
* @param {any} b
*/ (a, b) => a === b
: safe_equal
);
const prop = source(value);
prop.e = safe_equal; // TODO should this be default_equal?
_sources[name] = prop;
define_property(_props, name, {
get() {
@ -2666,11 +2658,10 @@ export function createRoot(component, options) {
return _props[property];
}
});
const props_source = source(
props_proxy,
// We're resetting the same proxy instance for updates, therefore bypass equality checks
() => false
);
const props_source = source(props_proxy);
// We're resetting the same proxy instance for updates, therefore bypass equality checks
props_source.e = safe_equal;
let [accessors, $destroy] = mount(component, {
...options,

@ -1142,25 +1142,20 @@ export function derived(init) {
/**
* @template V
* @param {V} initial_value
* @param {import('./types.js').EqualsFunctions<V>} [equals]
* @returns {import('./types.js').SourceSignal<V>}
*/
/*#__NO_SIDE_EFFECTS__*/
export function source(initial_value, equals) {
export function source(initial_value) {
const source = create_source_signal(SOURCE | CLEAN, initial_value);
source.x = current_component_context;
source.e = get_equals_method(equals);
source.e = get_equals_method();
return source;
}
/**
* @param {import('./types.js').EqualsFunctions} [equals]
* @returns {import('./types.js').EqualsFunctions}
*/
function get_equals_method(equals) {
if (equals !== undefined) {
return equals;
}
function get_equals_method() {
const context = current_component_context;
if (context && !context.i) {
return safe_equal;

@ -68,7 +68,6 @@ class Svelte4Component {
target: options.target,
props: { ...options.props, $$events: this.#events },
context: options.context,
immutable: options.immutable,
intro: options.intro,
recover: options.recover
});

Loading…
Cancel
Save