remove unused refs stuff

pull/1878/head
Rich Harris 7 years ago
parent 9dd08d8f11
commit be2e41b558

@ -80,7 +80,6 @@ export default class Component {
indirectDependencies: Map<string, Set<string>> = new Map(); indirectDependencies: Map<string, Set<string>> = new Map();
template_references: Set<string> = new Set(); template_references: Set<string> = new Set();
refs: Set<string> = new Set();
file: string; file: string;
locate: (c: number) => { line: number, column: number }; locate: (c: number) => { line: number, column: number };

@ -55,8 +55,6 @@ export default function dom(
builder.addBlock(block.toString()); builder.addBlock(block.toString());
}); });
const refs = Array.from(component.refs);
if (options.dev && !options.hydratable) { if (options.dev && !options.hydratable) {
block.builders.claim.addLine( block.builders.claim.addLine(
'throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");' 'throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");'
@ -87,14 +85,6 @@ export default function dom(
` `
: null; : null;
const inject_refs = refs.length > 0
? deindent`
$$refs => {
${refs.map(name => `${name} = $$refs.${name};`)}
}
`
: null;
const body = []; const body = [];
const not_equal = component.options.immutable ? `@not_equal` : `@safe_not_equal`; const not_equal = component.options.immutable ? `@not_equal` : `@safe_not_equal`;
@ -307,8 +297,6 @@ export default function dom(
if (${Array.from(d.dependencies).map(n => `$$dirty.${n}`).join(' || ')}) ${d.snippet}`)} if (${Array.from(d.dependencies).map(n => `$$dirty.${n}`).join(' || ')}) ${d.snippet}`)}
}; };
`} `}
${inject_refs && `$$self.$$.inject_refs = ${inject_refs};`}
} }
`); `);
} }

@ -10,12 +10,10 @@ export function bind(component, name, callback) {
} }
export function mount_component(component, target, anchor) { export function mount_component(component, target, anchor) {
const { fragment, refs, inject_refs, on_mount, on_destroy, after_render } = component.$$; const { fragment, on_mount, on_destroy, after_render } = component.$$;
fragment[fragment.i ? 'i' : 'm'](target, anchor); fragment[fragment.i ? 'i' : 'm'](target, anchor);
inject_refs(refs);
// onMount happens after the initial afterUpdate. Because // onMount happens after the initial afterUpdate. Because
// afterUpdate callbacks happen in reverse order (inner first) // afterUpdate callbacks happen in reverse order (inner first)
// we schedule onMount callbacks before afterUpdate callbacks // we schedule onMount callbacks before afterUpdate callbacks
@ -69,7 +67,6 @@ export function init(component, options, define, create_fragment, not_equal) {
get: empty, get: empty,
set: noop, set: noop,
update: noop, update: noop,
inject_refs: noop,
not_equal, not_equal,
bound: blankObject(), bound: blankObject(),
@ -82,7 +79,6 @@ export function init(component, options, define, create_fragment, not_equal) {
// everything else // everything else
callbacks: blankObject(), callbacks: blankObject(),
slotted: options.slots || {}, slotted: options.slots || {},
refs: {},
dirty: null, dirty: null,
binding_groups: [] binding_groups: []
}; };

@ -32,7 +32,6 @@ export function handlePromise(promise, info) {
block[block.i ? 'i' : 'm'](info.mount(), info.anchor); block[block.i ? 'i' : 'm'](info.mount(), info.anchor);
// TODO is some of this redundant? // TODO is some of this redundant?
info.component.$$.inject_refs(info.component.$$.refs);
run_all(info.component.$$.after_render); run_all(info.component.$$.after_render);
flush(); flush();
} }

@ -58,7 +58,6 @@ function update($$) {
$$.update($$.dirty); $$.update($$.dirty);
run_all($$.before_render); run_all($$.before_render);
$$.fragment.p($$.dirty, $$.get()); $$.fragment.p($$.dirty, $$.get());
$$.inject_refs($$.refs);
$$.dirty = null; $$.dirty = null;
$$.after_render.forEach(add_render_callback); $$.after_render.forEach(add_render_callback);

Loading…
Cancel
Save