@myrmidon/gve-core 7.0.11 → 7.0.12
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.
|
@@ -42,7 +42,7 @@ import * as i11 from '@angular/material/progress-bar';
|
|
|
42
42
|
import { MatProgressBarModule } from '@angular/material/progress-bar';
|
|
43
43
|
import { MatSliderModule } from '@angular/material/slider';
|
|
44
44
|
import { MatSlideToggle } from '@angular/material/slide-toggle';
|
|
45
|
-
import { DEFAULT_SETTINGS
|
|
45
|
+
import { DEFAULT_SETTINGS } from '@myrmidon/gve-snapshot-rendition';
|
|
46
46
|
|
|
47
47
|
/**
|
|
48
48
|
* Operation feature set policy.
|
|
@@ -2877,6 +2877,16 @@ class SnapshotEditorComponent {
|
|
|
2877
2877
|
this.initRendition(rendition);
|
|
2878
2878
|
}
|
|
2879
2879
|
});
|
|
2880
|
+
// re-apply settings whenever the renditionSettings input changes (e.g. loaded
|
|
2881
|
+
// asynchronously from the backend after the first render already completed)
|
|
2882
|
+
effect(() => {
|
|
2883
|
+
// reading renditionSettings() tracks it as a dependency
|
|
2884
|
+
this.renditionSettings();
|
|
2885
|
+
const rendition = this.renditionRef()?.nativeElement;
|
|
2886
|
+
if (rendition) {
|
|
2887
|
+
this.applyRenditionSettings();
|
|
2888
|
+
}
|
|
2889
|
+
});
|
|
2880
2890
|
// when operation editor panel becomes available, scroll it into view
|
|
2881
2891
|
effect(() => {
|
|
2882
2892
|
const panel = this.operationEditorPanelRef()?.nativeElement;
|
|
@@ -2897,9 +2907,19 @@ class SnapshotEditorComponent {
|
|
|
2897
2907
|
* Called via effect since the element is conditionally rendered.
|
|
2898
2908
|
*/
|
|
2899
2909
|
initRendition(rendition) {
|
|
2900
|
-
console.log('GveSnapshotRendition.version:', GveSnapshotRendition.version);
|
|
2910
|
+
// console.log('GveSnapshotRendition.version:', GveSnapshotRendition.version());
|
|
2901
2911
|
// set initial settings
|
|
2902
2912
|
this.applyRenditionSettings();
|
|
2913
|
+
// Push data immediately if already available. updateRendition() is called
|
|
2914
|
+
// synchronously after result.set() in runTo(), but at that moment the @if
|
|
2915
|
+
// block hasn't yet been added to the DOM (zoneless CD is asynchronous).
|
|
2916
|
+
// This call recovers from that missed push once the element is actually live.
|
|
2917
|
+
const result = this.result();
|
|
2918
|
+
if (result) {
|
|
2919
|
+
const r = { ...result, text: this.baseText.value };
|
|
2920
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2921
|
+
rendition.data = r;
|
|
2922
|
+
}
|
|
2903
2923
|
// listen to version change events
|
|
2904
2924
|
rendition.addEventListener('versionTagChange', (event) => {
|
|
2905
2925
|
const customEvent = event;
|
|
@@ -3433,8 +3453,13 @@ class SnapshotEditorComponent {
|
|
|
3433
3453
|
* @returns A promise that resolves to the execution result.
|
|
3434
3454
|
*/
|
|
3435
3455
|
runTo(index, lastOperation) {
|
|
3436
|
-
|
|
3437
|
-
|
|
3456
|
+
// Cancel any in-flight run so new data always wins over stale requests.
|
|
3457
|
+
// The old busy() guard silently dropped new requests while the API was
|
|
3458
|
+
// still responding, causing the component to freeze on rapid edits.
|
|
3459
|
+
if (this._currentRunSubscription) {
|
|
3460
|
+
this._currentRunSubscription.unsubscribe();
|
|
3461
|
+
this._currentRunSubscription = undefined;
|
|
3462
|
+
this.busy.set(false);
|
|
3438
3463
|
}
|
|
3439
3464
|
console.log('run to: ' + index);
|
|
3440
3465
|
// get the snapshot to run operations on
|
|
@@ -3457,7 +3482,7 @@ class SnapshotEditorComponent {
|
|
|
3457
3482
|
// run the operations
|
|
3458
3483
|
this.busy.set(true);
|
|
3459
3484
|
this.initialStepIndex.set(index);
|
|
3460
|
-
this._api
|
|
3485
|
+
this._currentRunSubscription = this._api
|
|
3461
3486
|
.runOperations(snapshot.text, snapshot.operations)
|
|
3462
3487
|
.subscribe({
|
|
3463
3488
|
next: (wrapper) => {
|
|
@@ -3469,7 +3494,10 @@ class SnapshotEditorComponent {
|
|
|
3469
3494
|
// set the result
|
|
3470
3495
|
console.log('result:', wrapper.result);
|
|
3471
3496
|
this.result.set(wrapper.result);
|
|
3472
|
-
// update the rendition component
|
|
3497
|
+
// update the rendition component; note that when result() transitions
|
|
3498
|
+
// from undefined→truthy the @if element may not yet be in the DOM
|
|
3499
|
+
// (zoneless CD is async). initRendition() will recover the missed push
|
|
3500
|
+
// once Angular inserts the element.
|
|
3473
3501
|
this.updateRendition();
|
|
3474
3502
|
// supply the last operation output tag from its result step if not set
|
|
3475
3503
|
if (!lastOperation.outputTag) {
|
|
@@ -3484,8 +3512,11 @@ class SnapshotEditorComponent {
|
|
|
3484
3512
|
error: (error) => {
|
|
3485
3513
|
console.error(error);
|
|
3486
3514
|
this._snackbar.open('Error running operations', 'OK');
|
|
3515
|
+
this._currentRunSubscription = undefined;
|
|
3516
|
+
this.busy.set(false);
|
|
3487
3517
|
},
|
|
3488
3518
|
complete: () => {
|
|
3519
|
+
this._currentRunSubscription = undefined;
|
|
3489
3520
|
this.busy.set(false);
|
|
3490
3521
|
},
|
|
3491
3522
|
});
|