@@ -23,6 +23,7 @@ import {
23
23
} from ' @cardstack/runtime-common' ;
24
24
import { Realm } from ' @cardstack/runtime-common/realm' ;
25
25
26
+ import type CardService from ' @cardstack/host/services/card-service' ;
26
27
import type OperatorModeStateService from ' @cardstack/host/services/operator-mode-state-service' ;
27
28
import { claimsFromRawToken } from ' @cardstack/host/services/realm' ;
28
29
import type RecentCardsService from ' @cardstack/host/services/recent-cards-service' ;
@@ -112,7 +113,7 @@ module('Acceptance | interact submode tests', function (hooks) {
112
113
static isolated = class Isolated extends Component <typeof this > {
113
114
<template >
114
115
<GridContainer class =' container' >
115
- <h2 ><@ fields.title /></h2 >
116
+ <h2 data-test-pet-title ><@ fields.title /></h2 >
116
117
<div >
117
118
<div >Favorite Treat: <@ fields.favoriteTreat /></div >
118
119
<div data-test-editable-meta >
@@ -574,6 +575,56 @@ module('Acceptance | interact submode tests', function (hooks) {
574
575
);
575
576
});
576
577
578
+ test <TestContextWithSave >(' a realm event with known clientRequestId is ignored' , async function (assert ) {
579
+ await visitOperatorMode ({
580
+ stacks: [
581
+ [
582
+ {
583
+ id: ` ${testRealmURL }Pet/vangogh ` ,
584
+ format: ' edit' ,
585
+ },
586
+ ],
587
+ ],
588
+ codePath: ` ${testRealmURL }Pet/vangogh.json ` ,
589
+ });
590
+
591
+ let deferred = new Deferred <void >();
592
+
593
+ this .onSave (() => {
594
+ deferred .fulfill ();
595
+ });
596
+
597
+ await fillIn (` [data-test-field="name"] input ` , ' Renamed via UI' );
598
+ await deferred .promise ;
599
+ await click (' [data-test-edit-button]' );
600
+
601
+ let knownClientRequestIds = (
602
+ this .owner .lookup (' service:card-service' ) as CardService
603
+ ).clientRequestIds .values ();
604
+
605
+ let knownClientRequestId = knownClientRequestIds .next ().value ;
606
+
607
+ await realm .write (
608
+ ' Pet/vangogh.json' ,
609
+ JSON .stringify ({
610
+ data: {
611
+ type: ' card' ,
612
+ attributes: {
613
+ name: ' Renamed via realm call' ,
614
+ },
615
+ meta: {
616
+ adoptsFrom: { module: ' http://test-realm/test/pet' , name: ' Pet' },
617
+ },
618
+ },
619
+ }),
620
+ knownClientRequestId ,
621
+ );
622
+
623
+ await settled ();
624
+
625
+ assert .dom (' [data-test-pet-title]' ).containsText (' Renamed via UI' );
626
+ });
627
+
577
628
test (' restoring the stack from query param when card is in edit format' , async function (assert ) {
578
629
await visitOperatorMode ({
579
630
stacks: [
0 commit comments