remove current_block

pull/10880/head
Rich Harris 2 years ago
parent 3ea5c31d20
commit 3ea2d51dcc

@ -12,7 +12,7 @@ import { is_array } from '../../utils.js';
import { set_should_intro } from '../../render.js';
import { current_each_item, set_current_each_item } from './each.js';
import { create_block } from './utils.js';
import { current_block, current_effect } from '../../runtime.js';
import { current_effect } from '../../runtime.js';
/**
* @param {import('#client').Effect} effect

@ -1,6 +1,5 @@
import { hydrating } from '../hydration.js';
import { render_effect } from '../../reactivity/effects.js';
import { current_block } from '../../runtime.js';
/**
* @param {HTMLElement} dom
@ -17,7 +16,7 @@ export function autofocus(dom, value) {
dom.focus();
}
},
current_block,
null,
true,
false
);

@ -5,7 +5,7 @@ import {
create_fragment_with_script_from_html,
insert
} from './reconciler.js';
import { current_block, current_effect } from '../runtime.js';
import { current_effect } from '../runtime.js';
import { is_array } from '../utils.js';
/**

@ -1,7 +1,6 @@
import { DEV } from 'esm-env';
import {
check_dirtiness,
current_block,
current_component_context,
current_effect,
current_reaction,
@ -34,7 +33,7 @@ import { noop } from '../../common.js';
* @param {boolean} init
* @returns {import('#client').Effect}
*/
function create_effect(type, fn, sync, block = current_block, init = true) {
function create_effect(type, fn, sync, block = null, init = true) {
/** @type {import('#client').Effect} */
const signal = {
parent: current_effect,
@ -99,7 +98,7 @@ export function user_effect(fn) {
current_component_context !== null &&
!current_component_context.m;
const effect = create_effect(EFFECT, fn, false, current_block, !defer);
const effect = create_effect(EFFECT, fn, false, null, !defer);
if (defer) {
const context = /** @type {import('#client').ComponentContext} */ (current_component_context);
@ -115,7 +114,7 @@ export function user_effect(fn) {
* @returns {() => void}
*/
export function user_root_effect(fn) {
const effect = render_effect(fn, current_block, true);
const effect = render_effect(fn, null, true);
return () => {
destroy_effect(effect);
};
@ -221,7 +220,7 @@ export function invalidate_effect(fn) {
* @param {any} sync
* @returns {import('#client').Effect}
*/
export function render_effect(fn, block = current_block, managed = false, sync = true) {
export function render_effect(fn, block = null, managed = false, sync = true) {
let flags = RENDER_EFFECT;
if (managed) {
flags |= MANAGED;

@ -107,11 +107,7 @@ export let inspect_fn = null;
/** @type {Array<import('./types.js').ValueDebug>} */
let inspect_captured_signals = [];
// Handle rendering tree blocks and anchors
/** @type {null | import('./types.js').Block} */
export let current_block = null;
// Handling runtime component context
/** @type {import('./types.js').ComponentContext | null} */
export let current_component_context = null;

Loading…
Cancel
Save