Warehouse 0.2.6: List search and sorting are kept in the address
Warehouse 0.2.6 keeps the search and sort order of every warehouse list in the page address, so a filtered list survives a reload, can be shared as a link, and the browser’s Back button returns to the previous search.
This covers all seven lists: stock, stocktakes, internal orders, supplier orders, goods receipts, goods issues and transfers. The address gains ?q=, ?sort= and ?dir=. Typing in the search box adds one history entry, not one per pause. The stock view and the warehouse scope stay personal settings and are not part of the address. Searching and sorting the stock list no longer reloads the stock from the database on every keystroke.
Also fixed: hiding the column a list was sorted by could leave the list unchanged after the column change. The list now picks the first visible column that can be sorted and refreshes.
Upgrading
The lists now use PhoenixKit’s PhoenixKitWeb.Live.UrlState, which first shipped in core 1.7.231: update core to 1.7.231 or later with this release.
Full release notes: Warehouse 0.2.6
0.2.6 · 5 August 2026
Added
- Warehouse list search and sort now live in the URL (PR #11) — all seven
index screens (
stock,inventories,internal_orders,supplier_orders,goods_receipts,goods_issues,transfers) adopt core’sPhoenixKitWeb.Live.UrlStatein:patchmode, exposing?q=,?sort=and?dir=. A filtered list is now a real URL: shareable, reload-proof, and Back returns to the previous query instead of leaving the page. List loading moves fromhandle_params/3to thehandle_url_state/2callback, so one code path serves the first render, a shared link and the Back button. The debounced search box patches withreplace: true, leaving one history entry rather than one per pause in typing.stock_viewandwarehouse_scopestay per-userViewConfigpreferences and are deliberately not in the URL. StockLivecaches its ledger snapshot per mount behind an explicit:stock_items_loaded?flag, so search and sort re-slice the loaded list instead of re-runningDeficits.available_by_item/0, the min-stock map and the Catalogue load on every keystroke.
Fixed
- Hiding the active sort column could leave the list stale — when a column
save hid the column being sorted by,
__view_config_changed__/1re-pickedList.first(selected_columns), which is the first visible column and need not be sortable (sub_order,supplier_order,location,source_location,destination_locationnever are, and column order is user-controlled).push_url_state/3sanitizes anything outside the declaredin:whitelist back to the default, so the re-pick silently collapsed to"number"/"item"— and when that was already the active sort, the URL state did not move at all,handle_url_state/2never re-ran, and the column or filter change that triggered it was never applied to the table. All seven screens now pick the first visible column that is actually sortable and refresh in place when the re-pick resolves to the current column. mix.lockcarried eight unused entries (igniter,sourceror,spitfire,rewrite,owl,text_diff,ex_ast,glob_ex) left over from the dependency bump in 0.2.5, whichmix deps.unlock --check-unusedrejects.
Testing
- New DB-less unit test pins each index LiveView’s
?sort=whitelist to thesortable?: truecolumns of itsColumnConfig— the two are the same fact written twice, and drift is silent: a sortable column left out of the whitelist cannot be sorted by at all. Also asserts each declared default sort column is itself sortable and that?dir=stayscast: :atomrestricted to[:asc, :desc].
Warehouse 0.2.6. Install or update: {:phoenix_kit_warehouse, "~> 0.2"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.