avo 4.1.16 → 4.2.0
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/Gemfile.lock +1 -1
- data/lib/avo/concerns/has_items.rb +37 -6
- data/lib/avo/skills/avo-update/SKILL.md +2 -1
- data/lib/avo/skills/docs-index.json +2 -2
- data/lib/avo/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: a8fc8217917ff1df1a558c0628a15ade9d6315ebfceaa37797d86a222c33c133
|
|
4
|
+
data.tar.gz: b29348ca3dbb0631138eb904a0b94f32fbfcbe3d600a889753cd76b6f48d7081
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2c4850f236ead8cc76af7a46a1eb72b0f63ee4b5be5db756a0c8e731064edfc5185b35471489e44174f66c261818a0e4dd813b75775ce994142a53a7abf4c8f8
|
|
7
|
+
data.tar.gz: a8b1779397837e6551fc26e2800b39e14e617c5fc25a66cfabe9b42b0d7af3c49c4047b242ca019131e67e8e627b00c038b8c8d35e38a9d374dcc56bf76c474b
|
data/Gemfile.lock
CHANGED
|
@@ -202,7 +202,44 @@ module Avo
|
|
|
202
202
|
items_holder&.items || []
|
|
203
203
|
end
|
|
204
204
|
|
|
205
|
+
# Every container asks its children whether they have anything visible, so one
|
|
206
|
+
# render may call this thousands of times and each call walks the whole subtree.
|
|
207
|
+
# Memoizing it offers a significant performance boost, particularly for large
|
|
208
|
+
# resources.
|
|
209
|
+
#
|
|
210
|
+
# It can't be a plain `||=` because the contextual items can change throughout a
|
|
211
|
+
# request lifecycle.
|
|
212
|
+
#
|
|
213
|
+
# The context is compared by object identity, so anything *replaced* recomputes.
|
|
214
|
+
# `items.size` is in there because `Holder#add_item` appends in place: a holder
|
|
215
|
+
# that gains an item keeps both its own identity and its array's, so the count is
|
|
216
|
+
# the only cheap signal that the items changed underneath us.
|
|
217
|
+
#
|
|
218
|
+
# Request-scoped state (params, context, current_user) is deliberately absent.
|
|
219
|
+
# `detect_fields` is a `before_action` and assigns a brand-new `Items::Holder`, so
|
|
220
|
+
# the memo is already cold at the top of every request and none of those can change
|
|
221
|
+
# within the lifetime of one entry.
|
|
205
222
|
def visible_items
|
|
223
|
+
hydration_resource = is_a?(Avo::Resources::Base) ? self : try(:resource)
|
|
224
|
+
context = [@items_holder, items.size, view.to_s.to_sym, hydration_resource.try(:record)]
|
|
225
|
+
|
|
226
|
+
unless @visible_items_context&.zip(context)&.all? { |was, now| was.equal?(now) }
|
|
227
|
+
@visible_items_context = context
|
|
228
|
+
# Frozen because every caller now shares one array. Without it a caller that
|
|
229
|
+
# mutates the result silently corrupts every later read instead of failing.
|
|
230
|
+
@visible_items = compute_visible_items.freeze
|
|
231
|
+
end
|
|
232
|
+
|
|
233
|
+
@visible_items
|
|
234
|
+
end
|
|
235
|
+
|
|
236
|
+
def is_empty?
|
|
237
|
+
visible_items.blank?
|
|
238
|
+
end
|
|
239
|
+
|
|
240
|
+
private
|
|
241
|
+
|
|
242
|
+
def compute_visible_items
|
|
206
243
|
items
|
|
207
244
|
.map do |item|
|
|
208
245
|
hydrate_item item
|
|
@@ -269,12 +306,6 @@ module Avo
|
|
|
269
306
|
end.compact
|
|
270
307
|
end
|
|
271
308
|
|
|
272
|
-
def is_empty?
|
|
273
|
-
visible_items.blank?
|
|
274
|
-
end
|
|
275
|
-
|
|
276
|
-
private
|
|
277
|
-
|
|
278
309
|
def set_target_to_top(fields)
|
|
279
310
|
fields.each do |field|
|
|
280
311
|
field.target = :_top
|
|
@@ -92,7 +92,7 @@ Guide sections are headed by version (`## Upgrade to 3.22.0`, `## Upgrade from 3
|
|
|
92
92
|
|
|
93
93
|
For each section between your before and after versions:
|
|
94
94
|
|
|
95
|
-
1. **Inventory first.** Grep for the API the section touches *before* changing anything. Most sections won't apply to a given app.
|
|
95
|
+
1. **Inventory first.** Grep for the API the section touches *before* changing anything — and where the section is about how a label or key resolves, grep `config/locales` too, since the trigger can be a key the app already defines rather than anything in its Ruby. Most sections won't apply to a given app.
|
|
96
96
|
2. Mark it **APPLIES / NOT USED / NEEDS REVIEW** in the log. Never apply a change for an API the app doesn't use.
|
|
97
97
|
3. If it applies, make the edit, then boot the app and re-run the tests.
|
|
98
98
|
4. Commit per section, with the version in the message.
|
|
@@ -163,6 +163,7 @@ Check the project's own instructions for how — in this order: `AGENTS.md`, `CL
|
|
|
163
163
|
- **The update alone is not the upgrade.** Bumping the gems and skipping the guide is the single most common way an admin breaks after an "upgrade" — and the breakage often surfaces days later, in a view nobody opened.
|
|
164
164
|
- **Apply sections oldest → newest.** They're written as a chain; applying 4.0.12's change before 4.0.7's can leave you editing code the earlier section was about to rename.
|
|
165
165
|
- **Silent default flips pass tests.** Sections that change a default (authorization strictness, confirmation modals, expanded filters) break nothing visible in CI and change runtime behavior. Call these out individually.
|
|
166
|
+
- **A section can be triggered by the app's locale files, not its Ruby.** Avo has been moving label resolution so a derived i18n key wins *over* the class attribute — actions in `4.0.17`, then cards, dashboards and scopes in `avo-dashboards` / `avo-scopes` `4.1.2`. Nothing in the app's Ruby changed, so grepping for an API name finds nothing; the trigger is a key the app already defines under `avo.action_translations`, `avo.card_translations`, `avo.dashboard_translations` or `avo.scope_translations`. Where one exists the class attribute stops being read **even when it's a lambda**, which is then never called and computes nothing, with no error. Grep those roots in `config/locales`, and move the collision with `self.translation_key` (or a value at the registration site) rather than deleting the key — **avo-i18n**.
|
|
166
167
|
- **Add-on gems version independently.** `avo-kanban 0.1.17 → 0.1.18` has its own section even when Avo core barely moved. Work the lock diff, not just the core version.
|
|
167
168
|
- **Assets after upgrade.** A GitHub-sourced install ships no precompiled assets — re-run `rake avo:build-assets` or the admin renders unstyled (**avo-setup**).
|
|
168
169
|
- **Don't invent a migration.** If a version's change isn't in the guide or the release notes, stop and ask rather than guessing at the new API.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"repo": "avo-hq/docs.avohq.io",
|
|
3
3
|
"docs_path": "docs/4.0",
|
|
4
|
-
"commit": "
|
|
5
|
-
"date": "2026-08-
|
|
4
|
+
"commit": "ee0277f1883e8a01c9d20503e05aa9f26170e93e",
|
|
5
|
+
"date": "2026-08-31",
|
|
6
6
|
"note": "The docs commit these skills were last indexed from. Run ruby lib/avo/skills/bin/docs_drift.rb to see what changed since, and --update after a refresh."
|
|
7
7
|
}
|
data/lib/avo/version.rb
CHANGED