Repository navigation
Categories: pages carry which types each category is, not each type's form - #427
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5b309afd4f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| on(:site_setting_changed) do |name, _old, _new| | ||
| Site.clear_cache if name.to_s == "jtech_lean_category_types" |
There was a problem hiding this comment.
Clear the cache when toggling the master switch
When an admin changes jtech_enabled, this handler does not invalidate the serialized category cache: enabling the plugin reaches the callback but fails this name check, while disabling it prevents the plugin-gated on callback from running at all. Consequently, a populated cache can continue serving either full or stripped type definitions for up to its 30-minute lifetime, so the master switch does not take effect promptly. Use an ungated enabled-change handler and clear Site's cache for both switches.
AGENTS.md reference: AGENTS.md:L21-L21
Useful? React with 👍 / 👎.
… form Every page preloads all the categories it may show, and each carried the full definition of every type it is: description, and every field of the type's settings form with labels and defaults. On prod that was 108 KB of every page for 58 categories. Outside the category editor the browser only asks which types a category is and shows a type's name and icon; the editor loads the category again through find_by_slug (CategorySerializer), which keeps the full definitions. The site's list now sends each type's id, name, title and icons: 9.7 KB on prod. jtech_lean_category_types (on) switches it off again; changing it clears the cached category list. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BUGDaR7qv2d8CuVp7UGSTs
5b309af to
27b4888
Compare
Summary
Every page preloads all the categories it may show, and each one carried the full definition of every type it is (
category_types): description, plus every field of that type's settings form with labels and defaults. On prod that was 108 KB on every page for 58 categories. Outside the category editor the browser only checks which types a category is (Category#isType, a plugin'scategoryTypes.documentation) and shows a type's name and icon. The editor reloads the category through/c/:slug/find_by_slug.json(CategorySerializer), which keeps the full definitions. The site list now sends each type's id, name, title, icon and svg_icon only: 9.7 KB on prod.It's scoped with
instance_of?(SiteCategorySerializer), soCategorySerializerand the admin serializer, which inherit from it, are untouched.jtech_lean_category_types(on by default) switches it off, and changing it clears the cached category list.Affected module(s)
Test plan
spec/requests/lean_category_types_spec.rb:simplified_category_creation_spec.rbandnew_category_spec.rbgive the same results with and without this change. They have 7 failures in the plugin test container either way, unrelated to this change.Checklist
pnpm lintis clean (no frontend changes)bundle exec rubocopis cleanconfig/locales/server.en.ymlorclient.en.yml🤖 Generated with Claude Code
https://claude.ai/code/session_01BUGDaR7qv2d8CuVp7UGSTs