jpie 4.1.4.pre.202610200314 → 4.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 +4 -4
- data/CHANGELOG.md +12 -0
- data/lib/json_api/controllers/concerns/resource_actions/serialization.rb +11 -2
- data/lib/json_api/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: eb96ac4995c6800cd07f48cd102d03820072ca58b8f1db35fcc54dece961a281
|
|
4
|
+
data.tar.gz: 7dfa2d854082e1b4848b94230a0ae06606751019c0b239308c4f57dc14027a7b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2e87c64831d1acbeaa40a4d0d91e2741e0d34c30585903ef7fe7d266daaa0359078549592eb1ae516a4dab9879a2d5e2e45b59ba452e797d4a6f3fe4014714c8
|
|
7
|
+
data.tar.gz: f4dba819c5a1e0b04997e623ce83bf568050e80842b93a75547b02be2232813d9f0f060cfb643d50c693c66bacf7785ae4fc071863748bd4241e5f7ff71460e7
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,18 @@ at release time.
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [4.1.4] - 2026-11-10
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- **Vet an STI include once for the base class.** The include filter vets
|
|
15
|
+
record ids under the class the association reads, the base class of an STI
|
|
16
|
+
tree. The warm step grouped the loaded records by their own subclass, so
|
|
17
|
+
the warm work was lost and the serializer ran its own query for each
|
|
18
|
+
parent. The warm step now uses the association class. An include of an STI
|
|
19
|
+
association costs one vetting query for the whole page. Regression spec:
|
|
20
|
+
`include_filter_sti_base_class_spec.rb`.
|
|
21
|
+
|
|
10
22
|
## [4.1.3] - 2026-10-10
|
|
11
23
|
|
|
12
24
|
### Fixed
|
|
@@ -71,9 +71,18 @@ module JSONAPI
|
|
|
71
71
|
cache
|
|
72
72
|
end
|
|
73
73
|
|
|
74
|
+
# The serializer vets a hop under the class its association reads, which
|
|
75
|
+
# is the base class of an STI tree. Warm under that same class, so both use
|
|
76
|
+
# one key, and warm once per class so the page size does not set the
|
|
77
|
+
# query count.
|
|
74
78
|
def warm_include_level(cache, records, association_name)
|
|
75
|
-
|
|
76
|
-
targets.
|
|
79
|
+
ids_by_klass = Hash.new { |hash, klass| hash[klass] = [] }
|
|
80
|
+
targets = records.flat_map do |record|
|
|
81
|
+
found = loaded_association_targets(record, association_name)
|
|
82
|
+
ids_by_klass[record.association(association_name).klass].concat(found.filter_map(&:id)) if found.any?
|
|
83
|
+
found
|
|
84
|
+
end
|
|
85
|
+
ids_by_klass.each { |klass, ids| cache.warm(klass, ids) }
|
|
77
86
|
targets
|
|
78
87
|
end
|
|
79
88
|
|
data/lib/json_api/version.rb
CHANGED