cdui-js 1.0.4 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,13 +1,12 @@
1
1
  {
2
2
  "name": "cdui-js",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "type": "module",
5
5
  "main": "src/index.ts",
6
6
  "bin": {
7
7
  "cdui-js": "./cli/bin.js"
8
8
  },
9
- "scripts": {
10
- },
9
+ "scripts": {},
11
10
  "dependencies": {
12
11
  "chalk": "^5.6.2",
13
12
  "commander": "^14.0.3",
@@ -21,4 +20,4 @@
21
20
  "@types/node": "^25.3.3",
22
21
  "typescript": "~5.6.2"
23
22
  }
24
- }
23
+ }
@@ -10,9 +10,9 @@ export interface SwitchProps {
10
10
  */
11
11
  component: () => JSX.Element;
12
12
  /**
13
- * 缓存 key
13
+ * 缓存 id
14
14
  */
15
- keepalive?: string;
15
+ id?: string;
16
16
  };
17
17
  }
18
18
 
@@ -30,14 +30,14 @@ export const Switch = (props: SwitchProps) => {
30
30
 
31
31
  return createMemo(() => {
32
32
  let branch = props.case;
33
- let keepalive;
33
+ let id;
34
34
 
35
35
  if (branch) {
36
- if ((keepalive = branch.keepalive)) {
36
+ if ((id = branch.id)) {
37
37
  return (
38
- roots[keepalive] ||
39
- (roots[keepalive] = createRoot((dispose) => {
40
- disposes[keepalive] = dispose;
38
+ roots[id] ||
39
+ (roots[id] = createRoot((dispose) => {
40
+ disposes[id] = dispose;
41
41
  return branch.component();
42
42
  }))
43
43
  );
package/src/reactive.ts CHANGED
@@ -127,8 +127,7 @@ export const watch = <T extends unknown>(deps: () => T, callbackFn: (values: T)
127
127
  createEffect(() => {
128
128
  // 已经初始化
129
129
  if (initialized) {
130
- // 不收集依赖的情况下执行回调
131
- untrack(() => callbackFn(deps()));
130
+ callbackFn(deps());
132
131
  } else {
133
132
  // 回集依赖
134
133
  deps();
@@ -171,6 +170,7 @@ export const createFetcher = <T>(promise?: () => Promise<T>, ssr_cache?: string)
171
170
  let data;
172
171
 
173
172
  if (promise) {
173
+ // @ts-ignore
174
174
  if (import.meta.env.SSR) {
175
175
  let id = createUniqueId();
176
176