@adobe-commerce/elsie 2.1.0-beta.1 → 2.1.0-beta.3
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/CHANGELOG.md +23 -0
- package/bin/builders/concurrently/index.js +1 -1
- package/package.json +1 -1
- package/src/lib/aem/assets.ts +18 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @adobe-commerce/elsie
|
|
2
2
|
|
|
3
|
+
## 2.1.0-beta.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 3bfb136: Fix an intermittent `insertBefore` crash in AEM Assets image slots
|
|
8
|
+
(`tryRenderAemAssetsImage`/`makeAemAssetsImageSlot`) that surfaced after the
|
|
9
|
+
preact 10.29 bump. The image render into its container was never awaited
|
|
10
|
+
before handing the container to `Slot`'s `replaceWith`, so it could be grafted
|
|
11
|
+
into the DOM before it had any content. See `docs/slot-dom-graft-race.md` for
|
|
12
|
+
the full trace.
|
|
13
|
+
|
|
14
|
+
## 2.1.0-beta.2
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- fe6e31d: Fix the `elsie concurrently` builder passing `killOthers` to the
|
|
19
|
+
`concurrently` package, which was renamed to `killOthersOn` in
|
|
20
|
+
`concurrently@10`. Since `concurrently` doesn't validate unknown options, the
|
|
21
|
+
mismatch silently no-opped `-k`/`--kill-others`, leaving sibling processes
|
|
22
|
+
(e.g. the `http-server` serving `storybook-static`) running after another
|
|
23
|
+
process in the group exited — hanging commands like `test-storybook-ci` until
|
|
24
|
+
an external timeout killed them.
|
|
25
|
+
|
|
3
26
|
## 2.1.0-beta.1
|
|
4
27
|
|
|
5
28
|
### Patch Changes
|
|
@@ -17,7 +17,7 @@ module.exports = function concurrentlyBuilder() {
|
|
|
17
17
|
const commands = argv._;
|
|
18
18
|
|
|
19
19
|
const options = {
|
|
20
|
-
|
|
20
|
+
killOthersOn: argv.killOthers ? ['success', 'failure'] : ['failure'],
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
if (argv.success !== 'all') {
|
package/package.json
CHANGED
package/src/lib/aem/assets.ts
CHANGED
|
@@ -238,7 +238,7 @@ export function tryGenerateAemAssetsOptimizedUrl(
|
|
|
238
238
|
|
|
239
239
|
/** Creates a slot that renders an AEM Assets image. */
|
|
240
240
|
export function makeAemAssetsImageSlot(config: AemAssetsImageSlotConfig) {
|
|
241
|
-
return (ctx: RenderContext) => {
|
|
241
|
+
return async (ctx: RenderContext): Promise<void> => {
|
|
242
242
|
const { wrapper, alias, params, imageProps } = config;
|
|
243
243
|
|
|
244
244
|
if (!imageProps.src) {
|
|
@@ -274,17 +274,25 @@ export function makeAemAssetsImageSlot(config: AemAssetsImageSlotConfig) {
|
|
|
274
274
|
params: imageComponentParams,
|
|
275
275
|
};
|
|
276
276
|
|
|
277
|
-
|
|
277
|
+
// Wait for the Image (and any of its own nested slots) to finish
|
|
278
|
+
// rendering into `container` before handing it to `ctx.replaceWith`.
|
|
279
|
+
// Slot grafts `container` into the DOM via an imperative `ref` callback
|
|
280
|
+
// that Preact's own diffing doesn't track (see docs/slot-dom-graft-race.md)
|
|
281
|
+
// -- handing it over before it has content means it gets grafted empty,
|
|
282
|
+
// then mutated again later outside Preact's bookkeeping, which is what
|
|
283
|
+
// was corrupting Preact's internal DOM pointers and causing sporadic
|
|
284
|
+
// `insertBefore` crashes after the preact 10.29 bump.
|
|
285
|
+
await UI.render(Image, imageComponentProps)(container);
|
|
278
286
|
ctx.replaceWith(container);
|
|
279
287
|
};
|
|
280
288
|
}
|
|
281
289
|
|
|
282
|
-
export function tryRenderAemAssetsImage(
|
|
290
|
+
export async function tryRenderAemAssetsImage(
|
|
283
291
|
ctx: RenderContext,
|
|
284
292
|
config: AemAssetsImageSlotConfig,
|
|
285
|
-
): void {
|
|
293
|
+
): Promise<void> {
|
|
286
294
|
// Renders an equivalent of the default image.
|
|
287
|
-
function renderDefaultImage(): void {
|
|
295
|
+
async function renderDefaultImage(): Promise<void> {
|
|
288
296
|
const container = config.wrapper ?? document.createElement('div');
|
|
289
297
|
const { imageProps, params } = config;
|
|
290
298
|
const imageComponentProps: ImageProps = {
|
|
@@ -293,7 +301,8 @@ export function tryRenderAemAssetsImage(
|
|
|
293
301
|
height: params.height,
|
|
294
302
|
};
|
|
295
303
|
|
|
296
|
-
|
|
304
|
+
// See the comment in `makeAemAssetsImageSlot` above.
|
|
305
|
+
await UI.render(Image, imageComponentProps)(container);
|
|
297
306
|
ctx.replaceWith(container);
|
|
298
307
|
}
|
|
299
308
|
|
|
@@ -301,7 +310,7 @@ export function tryRenderAemAssetsImage(
|
|
|
301
310
|
|
|
302
311
|
if (!assetsEnabled) {
|
|
303
312
|
// No-op, render the default image.
|
|
304
|
-
renderDefaultImage();
|
|
313
|
+
await renderDefaultImage();
|
|
305
314
|
return;
|
|
306
315
|
}
|
|
307
316
|
|
|
@@ -315,9 +324,9 @@ export function tryRenderAemAssetsImage(
|
|
|
315
324
|
|
|
316
325
|
if (!isAemAssetsUrl(assetsUrl)) {
|
|
317
326
|
// Not an AEM Assets URL, so render the default image.
|
|
318
|
-
renderDefaultImage();
|
|
327
|
+
await renderDefaultImage();
|
|
319
328
|
return;
|
|
320
329
|
}
|
|
321
330
|
|
|
322
|
-
makeAemAssetsImageSlot(config)(ctx);
|
|
331
|
+
await makeAemAssetsImageSlot(config)(ctx);
|
|
323
332
|
}
|