@@ -5,6 +5,179 @@ All notable changes to this project will be documented in this file.
55The format is based on [ Keep a Changelog] ( https://keepachangelog.com/en/1.0.0/ ) ,
66and this project adheres to [ Semantic Versioning] ( https://semver.org/spec/v2.0.0.html ) .
77
8+ ## [ 1.0.0] - 2025-10-31
9+
10+ ### Breaking Changes
11+
12+ - ** Renamed ` @prefix ` to ` @action_prefix ` in reducer modules**
13+ - All reducer modules must now use ` @action_prefix ` instead of ` @prefix `
14+ - The ` @action_prefix ` can be ` nil ` or ` "" ` to create catch-all reducers that handle all actions
15+ - Migration: Simply rename ` @prefix ` to ` @action_prefix ` in your reducer modules
16+ - Example:
17+ ``` elixir
18+ # Before (v0.x)
19+ defmodule MyReducer do
20+ use Phoenix .SessionProcess , :reducer
21+ @name :my_reducer
22+ @prefix " my" # Old name
23+ end
24+
25+ # After (v1.0.0)
26+ defmodule MyReducer do
27+ use Phoenix .SessionProcess , :reducer
28+ @name :my_reducer
29+ @action_prefix " my" # New name
30+ end
31+ ```
32+
33+ - ** Changed `dispatch/ 3 ` and `dispatch_async/ 3 ` return values**
34+ - Both functions now return `:ok ` instead of `{:ok , new_state}`
35+ - All dispatches are now async (fire- and - forget) by default
36+ - Use `get_state/ 1 - 2 ` to retrieve state after dispatch
37+ - Migration :
38+ ```elixir
39+ # Before (v0.x)
40+ {:ok , new_state} = SessionProcess .dispatch (session_id, :increment )
41+ IO .inspect (new_state)
42+
43+ # After (v1.0.0)
44+ :ok = SessionProcess .dispatch (session_id, :increment )
45+ new_state = SessionProcess .get_state (session_id)
46+ IO .inspect (new_state)
47+ ```
48+
49+ - ** Removed deprecated `Phoenix .SessionProcess .Redux ` module**
50+ - The old struct- based Redux API has been removed
51+ - Use the Redux Store API (built into SessionProcess ) instead
52+ - See migration guide: `REDUX_TO_SESSIONPROCESS_MIGRATION .md `
53+
54+ - ** Action prefix stripping in reducers**
55+ - Reducers with `@action_prefix ` now receive action types with the prefix stripped
56+ - When a reducer has `@action_prefix " counter" `, `handle_action` receives `" increment" ` instead of `" counter.increment" `
57+ - Dispatch calls still use full prefixed names (e.g., `dispatch (id, " counter.increment" )`)
58+ - Catch - all reducers (prefix `nil ` or `" " `) receive unchanged action types
59+ - Migration :
60+ ```elixir
61+ # Before (v0.x)
62+ defmodule CounterReducer do
63+ use Phoenix .SessionProcess , :reducer
64+ @name :counter
65+ @action_prefix " counter"
66+
67+ def handle_action (%Action {type: " counter.increment" }, state) do
68+ %{state | count: state.count + 1 }
69+ end
70+ end
71+
72+ # After (v1.0.0)
73+ defmodule CounterReducer do
74+ use Phoenix .SessionProcess , :reducer
75+ @name :counter
76+ @action_prefix " counter"
77+
78+ def handle_action (%Action {type: " increment" }, state) do
79+ %{state | count: state.count + 1 }
80+ end
81+ end
82+
83+ # Dispatch calls remain unchanged
84+ dispatch (session_id, " counter.increment" )
85+ ```
86+
87+ ## # Added
88+
89+ - ** `dispatch_async/ 3 ` function for explicit async dispatch**
90+ - Same behavior as `dispatch/ 3 ` but with clearer naming for async operations
91+ - Makes code intent more explicit when dispatching async actions
92+ - Example : `:ok = SessionProcess .dispatch_async (session_id, :increment )`
93+
94+ ## # Changed
95+
96+ - ** Improved action routing with `@action_prefix `**
97+ - More consistent naming aligns with action routing semantics
98+ - Catch - all reducers now explicitly use `nil ` or `" " ` for `@action_prefix `
99+ - Better documentation and examples for action routing
100+
101+ ## # Migration Guide
102+
103+ 1 . ** Rename `@prefix ` to `@action_prefix ` in all reducer modules**
104+ - Search your codebase for `@prefix ` in reducer modules
105+ - Replace with `@action_prefix `
106+ - No logic changes required
107+
108+ 2 . ** Update action type patterns in handle_action/ handle_async**
109+ - Remove the prefix from action type patterns
110+ - Example : `" counter.increment" ` becomes `" increment" `
111+ - Dispatch calls remain unchanged (still use full prefixed names)
112+ - Only affects reducers with non- nil / non- empty `@action_prefix `
113+
114+ 3 . ** Update dispatch call sites to handle `:ok ` return value**
115+ - Replace `{:ok , state} = dispatch (.. .)` with `:ok = dispatch (.. .)`
116+ - Add `get_state (session_id)` calls where you need the updated state
117+ - Consider : Do you actually need the state? Many dispatches are fire- and - forget
118+
119+ 4 . ** Remove uses of deprecated Redux module**
120+ - If using `Phoenix .SessionProcess .Redux ` struct- based API
121+ - Migrate to Redux Store API (SessionProcess IS the store)
122+ - See `REDUX_TO_SESSIONPROCESS_MIGRATION .md ` for detailed migration
123+
124+ ## # Notes
125+
126+ - All changes are breaking but migrations are straightforward
127+ - Most codebases will only need to rename `@prefix ` to `@action_prefix `
128+ - Dispatch return value change makes async nature more explicit
129+ - v0.9 .x will be the last version supporting deprecated APIs
130+
131+ ## [0.6.0] - 2025-10-29
132+
133+ ## # Added
134+ - ** Redux Store API ** : SessionProcess now IS the Redux store - no separate Redux struct needed
135+ - `Phoenix .SessionProcess .dispatch / 3 ` - Dispatch actions synchronously or asynchronously
136+ - `Phoenix .SessionProcess .subscribe / 4 ` - Subscribe to state changes with optional selectors
137+ - `Phoenix .SessionProcess .unsubscribe / 2 ` - Remove subscriptions
138+ - `Phoenix .SessionProcess .register_reducer / 3 ` - Register named reducers
139+ - `Phoenix .SessionProcess .register_selector / 3 ` - Register named selectors
140+ - `Phoenix .SessionProcess .get_state / 2 ` - Get state with optional selector
141+ - `Phoenix .SessionProcess .select / 2 ` - Apply registered selector to current state
142+ - `user_init/ 1 ` callback for defining initial Redux state
143+ - ** Enhanced LiveView Integration ** : New helpers for Redux Store API
144+ - `Phoenix .SessionProcess .LiveView .mount_store / 4 ` - Mount with direct SessionProcess subscriptions
145+ - `Phoenix .SessionProcess .LiveView .unmount_store / 1 ` - Clean up subscriptions (optional, automatic cleanup via monitoring)
146+ - `Phoenix .SessionProcess .LiveView .dispatch_store / 3 ` - Dispatch actions with sync/ async options
147+ - ** Selector - Based Subscriptions ** : Only receive updates when selected state changes
148+ - Efficient fine- grained state updates
149+ - Memoized selector support
150+ - Automatic equality checking to prevent unnecessary notifications
151+ - ** Process Monitoring ** : Automatic subscription cleanup when LiveView processes terminate
152+ - ** Comprehensive Documentation ** : Migration guides and examples
153+ - `MIGRATION_GUIDE .md ` - Quick migration guide with 2 - step process
154+ - `REDUX_TO_SESSIONPROCESS_MIGRATION .md ` - Detailed migration guide
155+ - `examples/ liveview_redux_store_example.ex` - Complete working example (400 + lines)
156+ - Updated CLAUDE .md with comprehensive Redux Store API documentation
157+
158+ ## # Changed
159+ - ** 70 % Less Boilerplate ** : Simplified API eliminates manual Redux struct management
160+ - ** Simpler Architecture ** : SessionProcess handles Redux infrastructure internally
161+ - ** Better Performance ** : Selector - based updates reduce unnecessary state notifications
162+ - ** Improved DX ** : Clearer code intent with less nesting and fewer concepts
163+
164+ ## # Deprecated
165+ - `Phoenix .SessionProcess .Redux ` module - Use Redux Store API instead
166+ - `Redux .init_state / 2 ` - Use `user_init/ 1 ` callback
167+ - `Redux .dispatch / 3 ` - Use `SessionProcess .dispatch / 3 `
168+ - `Redux .subscribe / 3 ` - Use `SessionProcess .subscribe / 4 `
169+ - `Redux .get_state / 1 ` - Use `SessionProcess .get_state / 2 `
170+ - `Phoenix .SessionProcess .LiveView ` old API - Use new Redux Store API
171+ - `mount_session/ 4 ` - Use `mount_store/ 4 `
172+ - `unmount_session/ 1 ` - Use `unmount_store/ 1 `
173+ - ** Migration Timeline ** : Deprecated APIs will be removed in v1.0.0 (supported through v0.9 .x)
174+
175+ ## # Migration
176+ - All old code continues to work with deprecation warnings
177+ - See `MIGRATION_GUIDE .md ` for quick 2 - step migration
178+ - See `REDUX_TO_SESSIONPROCESS_MIGRATION .md ` for detailed examples
179+ - No breaking changes - 100 % backward compatible
180+
8181## [0.4.0] - 2024-10-24
9182
10183## # Added
@@ -88,6 +261,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88261- Rate limiting and session limit enforcement
89262- Telemetry integration for monitoring
90263
264+ [0.6 .0 ]: https: // github.com/ gsmlg- dev/ phoenix_session_process/ compare/ v0.4.0 .. .v0.6.0
91265[0.4 .0 ]: https: // github.com/ gsmlg- dev/ phoenix_session_process/ compare/ v0.3.1 .. .v0.4.0
92266[0.3 .1 ]: https: // github.com/ gsmlg- dev/ phoenix_session_process/ compare/ v0.3.0 .. .v0.3.1
93267[0.3 .0 ]: https: // github.com/ gsmlg- dev/ phoenix_session_process/ compare/ v0.2.0 .. .v0.3.0
0 commit comments