phoenix_live_view 1.1.7 → 1.1.8
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/assets/js/phoenix_live_view/view.js +14 -12
- package/assets/js/types/view.d.ts +1 -1
- package/package.json +1 -1
- package/priv/static/phoenix_live_view.cjs.js +10 -8
- package/priv/static/phoenix_live_view.cjs.js.map +2 -2
- package/priv/static/phoenix_live_view.esm.js +10 -8
- package/priv/static/phoenix_live_view.esm.js.map +2 -2
- package/priv/static/phoenix_live_view.js +10 -8
- package/priv/static/phoenix_live_view.min.js +2 -2
|
@@ -832,12 +832,16 @@ export default class View {
|
|
|
832
832
|
});
|
|
833
833
|
}
|
|
834
834
|
|
|
835
|
-
update(diff, events) {
|
|
835
|
+
update(diff, events, isPending = false) {
|
|
836
836
|
if (
|
|
837
837
|
this.isJoinPending() ||
|
|
838
838
|
(this.liveSocket.hasPendingLink() && this.root.isMain())
|
|
839
839
|
) {
|
|
840
|
-
|
|
840
|
+
// don't mutate if this is already a pending diff
|
|
841
|
+
if (!isPending) {
|
|
842
|
+
this.pendingDiffs.push({ diff, events });
|
|
843
|
+
}
|
|
844
|
+
return false;
|
|
841
845
|
}
|
|
842
846
|
|
|
843
847
|
this.rendered.mergeDiff(diff);
|
|
@@ -875,6 +879,8 @@ export default class View {
|
|
|
875
879
|
if (phxChildrenAdded) {
|
|
876
880
|
this.joinNewChildren();
|
|
877
881
|
}
|
|
882
|
+
|
|
883
|
+
return true;
|
|
878
884
|
}
|
|
879
885
|
|
|
880
886
|
renderContainer(diff, kind) {
|
|
@@ -985,16 +991,12 @@ export default class View {
|
|
|
985
991
|
}
|
|
986
992
|
|
|
987
993
|
applyPendingUpdates() {
|
|
988
|
-
// prevent race conditions where we might still be pending a new
|
|
989
|
-
// navigation
|
|
990
|
-
// if
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
return;
|
|
995
|
-
}
|
|
996
|
-
this.pendingDiffs.forEach(({ diff, events }) => this.update(diff, events));
|
|
997
|
-
this.pendingDiffs = [];
|
|
994
|
+
// To prevent race conditions where we might still be pending a new
|
|
995
|
+
// navigation or the join is still pending, `this.update` returns false
|
|
996
|
+
// if the diff was not applied.
|
|
997
|
+
this.pendingDiffs = this.pendingDiffs.filter(
|
|
998
|
+
({ diff, events }) => !this.update(diff, events, true),
|
|
999
|
+
);
|
|
998
1000
|
this.eachChild((child) => child.applyPendingUpdates());
|
|
999
1001
|
}
|
|
1000
1002
|
|
|
@@ -78,7 +78,7 @@ export default class View {
|
|
|
78
78
|
isJoinPending(): boolean;
|
|
79
79
|
ackJoin(_child: any): void;
|
|
80
80
|
onAllChildJoinsComplete(): void;
|
|
81
|
-
update(diff: any, events: any):
|
|
81
|
+
update(diff: any, events: any, isPending?: boolean): boolean;
|
|
82
82
|
renderContainer(diff: any, kind: any): any;
|
|
83
83
|
componentPatch(diff: any, cid: any): boolean;
|
|
84
84
|
getHook(el: any): any;
|
package/package.json
CHANGED
|
@@ -4619,9 +4619,12 @@ var View = class _View {
|
|
|
4619
4619
|
this.pendingJoinOps = [];
|
|
4620
4620
|
});
|
|
4621
4621
|
}
|
|
4622
|
-
update(diff, events) {
|
|
4622
|
+
update(diff, events, isPending = false) {
|
|
4623
4623
|
if (this.isJoinPending() || this.liveSocket.hasPendingLink() && this.root.isMain()) {
|
|
4624
|
-
|
|
4624
|
+
if (!isPending) {
|
|
4625
|
+
this.pendingDiffs.push({ diff, events });
|
|
4626
|
+
}
|
|
4627
|
+
return false;
|
|
4625
4628
|
}
|
|
4626
4629
|
this.rendered.mergeDiff(diff);
|
|
4627
4630
|
let phxChildrenAdded = false;
|
|
@@ -4651,6 +4654,7 @@ var View = class _View {
|
|
|
4651
4654
|
if (phxChildrenAdded) {
|
|
4652
4655
|
this.joinNewChildren();
|
|
4653
4656
|
}
|
|
4657
|
+
return true;
|
|
4654
4658
|
}
|
|
4655
4659
|
renderContainer(diff, kind) {
|
|
4656
4660
|
return this.liveSocket.time(`toString diff (${kind})`, () => {
|
|
@@ -4729,11 +4733,9 @@ var View = class _View {
|
|
|
4729
4733
|
delete this.viewHooks[hookId];
|
|
4730
4734
|
}
|
|
4731
4735
|
applyPendingUpdates() {
|
|
4732
|
-
|
|
4733
|
-
|
|
4734
|
-
|
|
4735
|
-
this.pendingDiffs.forEach(({ diff, events }) => this.update(diff, events));
|
|
4736
|
-
this.pendingDiffs = [];
|
|
4736
|
+
this.pendingDiffs = this.pendingDiffs.filter(
|
|
4737
|
+
({ diff, events }) => !this.update(diff, events, true)
|
|
4738
|
+
);
|
|
4737
4739
|
this.eachChild((child) => child.applyPendingUpdates());
|
|
4738
4740
|
}
|
|
4739
4741
|
eachChild(callback) {
|
|
@@ -5788,7 +5790,7 @@ var LiveSocket = class {
|
|
|
5788
5790
|
}
|
|
5789
5791
|
// public
|
|
5790
5792
|
version() {
|
|
5791
|
-
return "1.1.
|
|
5793
|
+
return "1.1.8";
|
|
5792
5794
|
}
|
|
5793
5795
|
isProfileEnabled() {
|
|
5794
5796
|
return this.sessionStorage.getItem(PHX_LV_PROFILE) === "true";
|