Skip to content

Module Manager: remember the tab filter + table state across the activate reload - #326

Closed
WebTigers wants to merge 1 commit into
mainfrom
fix/modules-remember-filter
Closed

WebTigers wants to merge 1 commit into
mainfrom
fix/modules-remember-filter

Conversation

@WebTigers

Copy link
Copy Markdown
Owner

What

The Module Manager's type-filter tab is now remembered across a page refresh (per-browser,
localStorage), and the modules DataTable gets stateSave so sort / page / length / search also
survive a reload.

Why

Two linked issues Beau hit:

  1. The tab filter was a transient JS var (activeType) reset to '' on every load — never persisted.
  2. Activate/deactivate does window.location.reload(), which wiped that client-only filter state (and
    the sort/page/search), always dumping you back on All.

The reload (the "why is it refreshing anyway?")

Kept, deliberately: activating a module changes several server-rendered regions — the row's badge +
its activate↔deactivate button, the type-filter counts, the admin sidebar nav / Settings tree a
newly-active module contributes, and the theme-default marker. The reload is the simple way to reflect
all of them. This change makes the reload non-destructive (you land exactly where you were) rather
than removing it. A full no-reload, in-place row+nav reconciliation is a larger follow-up (and the
TigerAgent app-shell is the real vehicle for that); flagged, not done here.

Notes

  • localStorage is the sanctioned spot for a per-viewer UI convenience like a remembered filter; every
    access is try/catch-guarded, and a stored type whose pill no longer exists falls back to All.
  • Edits are confined to the existing inline script in modules/system/views/scripts/modules/index.phtml.

🤖 Generated with Claude Code

https://claude.ai/code/session_01ASauLLscjqdsNqBNsx2Typ

…vate reload

The type-filter tab was a transient JS var reset to '' on every load, and activate/deactivate does a
full window.location.reload() — so a reload (especially the one after a toggle) always dropped you back
on "All" and lost your sort/page/search. Now the chosen tab is persisted per-browser (localStorage,
try/catch-guarded) and restored on load (a stale type falls back to All), and the DataTable gets
stateSave so sort/page/length/search survive the reload too. The reload still runs (it reflects the
server-rendered row state, filter counts, sidebar nav and theme-default marker that activation changes)
— it's just no longer destructive to where you were.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01ASauLLscjqdsNqBNsx2Typ
@WebTigers

Copy link
Copy Markdown
Owner Author

Superseded by the ajax DataTable refactor (#327): the grid now fetches already-filtered rows, so the tab FOUC is gone and tigerDataTable's stateSave covers sort/page/search natively.

@WebTigers WebTigers closed this Oct 2, 2026
@WebTigers
WebTigers deleted the fix/modules-remember-filter branch October 6, 2026 13:32
WebTigers added a commit that referenced this pull request Oct 10, 2026
…ilter FOUC (#327)

* Module Manager: ajax DataTable (client/server paradigm) — fixes the filter FOUC

The modules grid server-rendered every row and filtered client-side, so a remembered tab flashed All →
the chosen type on load. Refactored to the Tiger datatable paradigm the Users table uses: an EMPTY table
fed by System_Service_Modules::datatable over /api (server-side search / type-filter / sort / paginate),
column renderers that build the cells + gate the activate/deactivate/delete controls off per-row flags
(can_toggle / can_delete), and the chosen type remembered in a cookie the controller reads so the active
pill renders server-side and the first ajax load is already filtered — no flash. catalog() is the shared
authority (controller pills + the feed). Activate/delete now re-fetch the grid in place
(table.ajax.reload) instead of window.location.reload, and the full-catalog counts ride each response so
the pills stay accurate. Removes the inline <style> (the desc clamp is an inline style attr in the
renderer). Supersedes #326 (tab persistence) — tigerDataTable's stateSave covers sort/page/search for free.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01ASauLLscjqdsNqBNsx2Typ

* test: update modules-screen dispatch test for the ajax DataTable paradigm

#327 moved the modules list off server-rendered $this->view->modules onto the
System_Service_Modules::datatable /api endpoint, so the old assertion ("the
screen builds the on-disk module list") now sees null. Assert the new contract:
index dispatches 200 (the shell), and datatable() returns the on-disk rows with
active/protected/source + system flagged protected. Also covers datatable().

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01ASauLLscjqdsNqBNsx2Typ

* test: import System_Service_Modules (global class) in the namespaced dispatch test

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01ASauLLscjqdsNqBNsx2Typ

---------

Co-authored-by: Claude Opus 4.8 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant