dom-expressions 0.37.13 → 0.37.14

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,7 +1,7 @@
1
1
  {
2
2
  "name": "dom-expressions",
3
3
  "description": "A Fine-Grained Runtime for Performant DOM Rendering",
4
- "version": "0.37.13",
4
+ "version": "0.37.14",
5
5
  "author": "Ryan Carniato",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -29,5 +29,5 @@
29
29
  "seroval": "^1.0.2",
30
30
  "seroval-plugins": "^1.0.2"
31
31
  },
32
- "gitHead": "ae2bc5ecd4f8dd61df0b2eb5c4ed0ae7589b6a6b"
32
+ "gitHead": "e4ec396f109c89a1b86d82b53bbfbf2cc66764b1"
33
33
  }
package/src/client.js CHANGED
@@ -308,7 +308,7 @@ function assignProp(node, prop, value, prev, isSVG, skipRef) {
308
308
  let isCE, isProp, isChildProp, propAlias, forceProp;
309
309
  if (prop === "style") return style(node, value, prev);
310
310
  if (prop === "classList") return classList(node, value, prev);
311
- if (value === prev && (prop !== "value" || prop !== "checked")) return prev;
311
+ if (value === prev && prop !== "value" && prop !== "checked") return prev;
312
312
  if (prop === "ref") {
313
313
  if (!skipRef) value(node);
314
314
  } else if (prop.slice(0, 3) === "on:") {
package/src/server.js CHANGED
@@ -65,7 +65,6 @@ export function renderToStream(code, options = {}) {
65
65
  const blockingPromises = [];
66
66
  const pushTask = task => {
67
67
  if (noScripts) return;
68
- // TODO is the correct place to put this
69
68
  if (!tasks && !firstFlushed) {
70
69
  tasks = getLocalHeaderScript(renderId);
71
70
  }
@@ -74,24 +73,23 @@ export function renderToStream(code, options = {}) {
74
73
  timer = setTimeout(writeTasks);
75
74
  }
76
75
  };
77
- const checkEnd = () => {
78
- if (!registry.size && !completed) {
79
- writeTasks();
80
- onCompleteAll &&
81
- onCompleteAll({
82
- write(v) {
83
- !completed && buffer.write(v);
84
- }
85
- });
86
- writable && writable.end();
87
- completed = true;
88
- setTimeout(dispose);
89
- }
76
+ const onDone = () => {
77
+ writeTasks();
78
+ doShell();
79
+ onCompleteAll &&
80
+ onCompleteAll({
81
+ write(v) {
82
+ !completed && buffer.write(v);
83
+ }
84
+ });
85
+ writable && writable.end();
86
+ completed = true;
87
+ if (firstFlushed) dispose();
90
88
  };
91
89
  const serializer = createSerializer({
92
90
  scopeId: options.renderId,
93
91
  onData: pushTask,
94
- onDone: checkEnd,
92
+ onDone,
95
93
  onError: options.onError
96
94
  });
97
95
  const flushEnd = () => {
@@ -118,6 +116,7 @@ export function renderToStream(code, options = {}) {
118
116
  let tasks = "";
119
117
  let firstFlushed = false;
120
118
  let completed = false;
119
+ let shellCompleted = false;
121
120
  let scriptFlushed = false;
122
121
  let timer = null;
123
122
  let buffer = {
@@ -208,6 +207,7 @@ export function renderToStream(code, options = {}) {
208
207
  return resolveSSRNode(escape(code()));
209
208
  });
210
209
  function doShell() {
210
+ if (shellCompleted) return;
211
211
  sharedConfig.context = context;
212
212
  context.noHydrate = true;
213
213
  html = injectAssets(context.assets, html);
@@ -220,12 +220,12 @@ export function renderToStream(code, options = {}) {
220
220
  !completed && buffer.write(v);
221
221
  }
222
222
  });
223
+ shellCompleted = true;
223
224
  }
224
-
225
225
  return {
226
226
  then(fn) {
227
227
  function complete() {
228
- doShell();
228
+ dispose();
229
229
  fn(tmp);
230
230
  }
231
231
  if (onCompleteAll) {
@@ -235,7 +235,7 @@ export function renderToStream(code, options = {}) {
235
235
  complete();
236
236
  };
237
237
  } else onCompleteAll = complete;
238
- if (!registry.size) queue(flushEnd);
238
+ queue(flushEnd);
239
239
  },
240
240
  pipe(w) {
241
241
  allSettled(blockingPromises).then(() => {
@@ -244,8 +244,10 @@ export function renderToStream(code, options = {}) {
244
244
  buffer = writable = w;
245
245
  buffer.write(tmp);
246
246
  firstFlushed = true;
247
- if (completed) writable.end();
248
- else queue(flushEnd);
247
+ if (completed) {
248
+ dispose();
249
+ writable.end();
250
+ } else flushEnd();
249
251
  });
250
252
  });
251
253
  },
@@ -271,8 +273,10 @@ export function renderToStream(code, options = {}) {
271
273
  };
272
274
  buffer.write(tmp);
273
275
  firstFlushed = true;
274
- if (completed) writable.end();
275
- else queue(flushEnd);
276
+ if (completed) {
277
+ dispose();
278
+ writable.end();
279
+ } else flushEnd();
276
280
  });
277
281
  return p;
278
282
  });