iknow_view_models 3.1.3 → 3.1.4
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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec9588bf18a627cee4ffefc47ca45c430d733121aa093809cdd366cb8d167d50
|
4
|
+
data.tar.gz: 7ff4fe90c65d67251282626bc9ed5d367c6679b879e138fea8cc0b7b32ecfcf0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f57f01263cc27d284e31d484f07b56960e5cf743380f912b223e62ceee28dff69fa061f6bdb58c7ac005e5e8b7d0421d8da319ac7debd61160787718f5f77c6e
|
7
|
+
data.tar.gz: 76cd1b4f2a14748200b27a704299d7b8a6a610af8e2f32c5517f3d92791793de08257627c1bb6a0ee36785b925ee64af233eab859addc01871ad5165b332ebe3
|
@@ -94,11 +94,16 @@ class ViewModel::ActiveRecord
|
|
94
94
|
# won't yet include through a polymorphic boundary: for now we become
|
95
95
|
# lazy-loading and slow every time that happens.
|
96
96
|
|
97
|
-
# Combine our root and referenced updates, and separate by viewmodel type
|
97
|
+
# Combine our root and referenced updates, and separate by viewmodel type.
|
98
|
+
# Sort by id where possible to obtain as close to possible a deterministic
|
99
|
+
# update order to avoid database write deadlocks. This can't be entirely
|
100
|
+
# comprehensive, since we can't control the order that shared references
|
101
|
+
# are referred to from roots (and therefore visited).
|
98
102
|
updates_by_viewmodel_class =
|
99
103
|
root_updates.lazily
|
100
104
|
.map { |root_update| [nil, root_update] }
|
101
105
|
.concat(referenced_updates)
|
106
|
+
.sort_by { |_, update_data| update_data.metadata.id.to_s }
|
102
107
|
.group_by { |_, update_data| update_data.viewmodel_class }
|
103
108
|
|
104
109
|
# For each viewmodel type, look up referenced models and construct viewmodels to update
|
@@ -115,7 +120,7 @@ class ViewModel::ActiveRecord
|
|
115
120
|
|
116
121
|
if models.size < model_ids.size
|
117
122
|
missing_model_ids = model_ids - models.map(&:id)
|
118
|
-
missing_viewmodel_refs = missing_model_ids.map
|
123
|
+
missing_viewmodel_refs = missing_model_ids.map { |id| ViewModel::Reference.new(viewmodel_class, id) }
|
119
124
|
raise ViewModel::DeserializationError::NotFound.new(missing_viewmodel_refs)
|
120
125
|
end
|
121
126
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iknow_view_models
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.
|
4
|
+
version: 3.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- iKnow Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-03-
|
11
|
+
date: 2020-03-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|