import { jsx, jsxs, Fragment } from 'solid-jsx/jsx-runtime';

/*@jsxRuntime automatic @jsxImportSource solid-jsx*/
const toc = [];
function _createMdxContent(props) {
  const _components = Object.assign({
    p: "p",
    code: "code",
    pre: "pre",
    span: "span"
  }, props.components);
  return jsxs(Fragment, {
    children: [jsxs(_components.p, {
      children: ["有时希望 Signal 读取行为不被跟踪，即使在响应式上下文中也是如此 Solid 提供了 ", jsx(_components.code, {
        children: "untrack"
      }), " 工具函数来避免包装计算跟踪任何读取行为。"]
    }), "\n", jsxs(_components.p, {
      children: ["在示例中，假设我们不想在 ", jsx(_components.code, {
        children: "b"
      }), " 更改时输出日志。我们可以通过将 Effect 更改为以下内容来取消跟踪 ", jsx(_components.code, {
        children: "b"
      }), " Signal："]
    }), "\n", jsx(_components.pre, {
      children: jsxs(_components.code, {
        className: "hljs language-js",
        children: [jsx(_components.span, {
          className: "hljs-title function_",
          children: "createEffect"
        }), "(", jsx(_components.span, {
          className: "hljs-function",
          children: "() =>"
        }), " {\n  ", jsx(_components.span, {
          className: "hljs-variable language_",
          children: "console"
        }), ".", jsx(_components.span, {
          className: "hljs-title function_",
          children: "log"
        }), "(", jsx(_components.span, {
          className: "hljs-title function_",
          children: "a"
        }), "(), ", jsx(_components.span, {
          className: "hljs-title function_",
          children: "untrack"
        }), "(b));\n});\n"]
      })
    }), "\n", jsx(_components.p, {
      children: "由于 Signal 是函数，可以直接传递，但 untrack 可以包装具有行为更复杂的函数。"
    }), "\n", jsxs(_components.p, {
      children: ["即使 ", jsx(_components.code, {
        children: "untrack"
      }), " 禁用了对读取的跟踪，但对写入并通知观察者并没有影响。"]
    })]
  });
}
function MDXContent(props = {}) {
  const {wrapper: MDXLayout} = props.components || ({});
  return MDXLayout ? jsx(MDXLayout, Object.assign({}, props, {
    children: jsx(_createMdxContent, props)
  })) : _createMdxContent(props);
}

export { MDXContent as default, toc };
//# sourceMappingURL=lesson-7ffab349.js.map
