recourse 5.6.1 → 5.6.2

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: 35965cb0f94b2d2fca0366cea985b802e99b777307c665028a112cab73bd37e4
4
- data.tar.gz: 3ba554f83c3f8a9525482ea3df5a5d8c41356fc00897a25d5bce865c36f90792
3
+ metadata.gz: 064c3ed09111afd19f1d3e11c5a612cd89fa791ed1af947e443bb15b4af7b331
4
+ data.tar.gz: d93cb6f3a73e164ebba8a2aebad883f3bbf8caf5bc30d5b314b454f130013c1c
5
5
  SHA512:
6
- metadata.gz: a562bc4ad1b45cb1f29a82fe2bb81a69d85d59771becf9761da3cc4ef34dbbd14f6e251f5904fa0b0a42104cfdbe295bbdfdc191704284eb6f069bed5574daf2
7
- data.tar.gz: d71660925c2cf5cc173240c7404254e1f0a5ff3bf1a9c75d8dc7a9a5856266fa21f2622cd0f1fb9fd1e65afccbf2472b5c8627bb89582e4656ca0072db18aea3
6
+ metadata.gz: 158d0cfe8800d1b44812f358d6033ffcb00da7adbbe2e52c2264d97e18115cfc7e96c70e38b7e7c9eb40c8ed9b9658095b49314497e31459d7a62e21b011e127
7
+ data.tar.gz: f573d4015aa37561ea7be6272120394aeeb96d9a7c55a0732680f6a135769b96361529da4a1d6a69767fd542bbb6457a8ae3dda1be99f9105568936d371af182
data/CHANGELOG.md CHANGED
@@ -7,6 +7,19 @@ For more information about changelogs, check [Keep a Changelog](http://keepachan
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## 5.6.2 - 2026-09-18
11
+
12
+ * [Fix] A kept table notices a count that changed
13
+
14
+ The key a table is cached under carried the rows, the newest `updated_at` among them and
15
+ everything they reach along `includes` — but not the counts they draw. A counter cache is
16
+ written by `update_counters`, which moves no timestamp, so a row whose children changed is
17
+ one `MAX(updated_at)` still calls unchanged: an agent who claimed two contacts went on
18
+ reading `0 contacts` until something else wrote to the agent.
19
+
20
+ The counts go in the key beside the version. They are read off the rows already in memory,
21
+ so this costs no query, the way reading that version costs none.
22
+
10
23
  ## 5.6.1 - 2026-09-18
11
24
 
12
25
  * [Change] The pinned bundle is `houseaccount@0.14.2`
@@ -4,6 +4,9 @@
4
4
  <%# The key carries what the rows draw besides their own columns: `MAX(updated_at)`
5
5
  over the relation sees only the rows themselves, so a name or a ZIP read off the
6
6
  record a row points at would keep whatever it said when the fragment was written.
7
+ And the counts they draw, which no timestamp moves: a counter cache is written by
8
+ `update_counters`, so a row whose children changed is one `MAX(updated_at)` still
9
+ calls unchanged.
7
10
  And the row partial's digest: a host's `_row` is resolved at render, which the
8
11
  fragment's own template digest never follows.
9
12
  And the column list: which columns a table shows is decided in Ruby —
@@ -13,8 +16,8 @@
13
16
  the fragment when a square is clicked. And the zone, for the same reason again:
14
17
  a timestamp is drawn against the reader's own clock, so without it the first
15
18
  person to load a table would settle what hour everybody else read. -%>
16
- <% key = [recourses, rows_version(recourses), row_digest, resource_columns,
17
- bookmark_digest, Time.zone.name] -%>
19
+ <% key = [recourses, rows_version(recourses), counters_version(recourses), row_digest,
20
+ resource_columns, bookmark_digest, Time.zone.name] -%>
18
21
  <% cache_if cacheable_table?, key do %>
19
22
  <% actions = resource_actions %>
20
23
  <%# Read once for the whole table: every row of it is positioned or none is. -%>
@@ -33,6 +33,18 @@ module Recourse
33
33
  drawn.filter_map { |one| one.try :updated_at }.max&.utc&.to_fs :usec
34
34
  end
35
35
 
36
+ # The counts the rows draw, which the version above cannot see. A counter cache is
37
+ # written by `update_counters`, which moves no timestamp, so a row whose children
38
+ # changed is a row `MAX(updated_at)` still calls unchanged -- and the table went on
39
+ # showing the count it was cached with. Read off the rows in memory like the
40
+ # version is, so this costs no query either.
41
+ def counters_version(rows)
42
+ columns = resource_model.recourse_counters.keys
43
+ return if columns.empty?
44
+
45
+ rows.map { |row| row.attributes.values_at(*columns) }
46
+ end
47
+
36
48
  # Every record the rows reach along `includes`, in any shape `includes` accepts:
37
49
  # a name, a list of them, or a hash naming what to follow from there.
38
50
  def reached(rows, names)
@@ -1,4 +1,4 @@
1
1
  module Recourse
2
2
  # Version of the gem, read by the gemspec and by hosts checking compatibility.
3
- VERSION = '5.6.1'
3
+ VERSION = '5.6.2'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: recourse
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.6.1
4
+ version: 5.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - claudiob