Commit 43e819e
committed
feat(llc): implement client-side state for all list types
This commit introduces client-side state management for all list types:
- `ActivityList`
- `ActivityCommentList`
- `ActivityReactionList`
- `BookmarkList`
- `BookmarkFolderList`
- `CommentReplyList`
- `CommentReactionList`
- `FollowList`
- `PollList`
- `PollVoteList`
It also implements the `Activity` state object.
Each list type and the `Activity` object now have:
- A dedicated state notifier (e.g., `ActivityListStateNotifier`).
- A corresponding state class (e.g., `ActivityListState`) using `freezed`.
- Event handlers for real-time updates via WebSockets (e.g., `ActivityListEventHandler`).
Key changes:
- `FeedsClientImpl`:
- Instantiates and returns the new stateful list objects.
- Passes necessary repositories and event emitters to these objects.
- Adds `pollAnswerCastedFeedEventResolver` and `pollAnswerRemovedFeedEventResolver` to WebSocket event resolvers.
- Corrects user image field in `_authenticateUser`.
- Handles `ClientException` for anonymous user connection attempts.
- State notifiers:
- Manage the data (e.g., activities, comments) and pagination state.
- Provide methods to update the state based on API responses and WebSocket events.
- Utilize `QueryConfiguration` to store and use filter and sort parameters.
- State classes:
- Define the structure of the observable state (e.g., list of items, pagination data).
- Include a `canLoadMore` getter.
- Event handlers:
- Process specific WebSocket events relevant to their list type.
- Call appropriate methods on the state notifier to update the state.
- Model updates:
- `ThreadedCommentData`: Added mutation methods for reactions and replies, and a `setCommentData` method.
- `ActivitiesSortField`: `createdAt` now uses `data.createdAt`, `popularity` uses `data.popularity`.
- `ReactionGroupData`: Improved logic in `decrement` and `increment` methods.
- `PollData`: Added `ownVotesAndAnswers`, `ownVotes`, `ownAnswers`, and `latestVotes` getters. Added mutation methods for options and answers.
- `PollVoteData`: `isAnswer` is now a getter based on `answerText`.
- Repository updates:
- `CommentsRepository`: `deleteComment` now accepts an optional `hardDelete` parameter.
- `PollsRepository`: Removed `userId` parameter from `deletePoll`, `getPoll`, `deletePollOption`, `getPollOption`, and `deletePollVote`.
- New event resolvers:
- `pollAnswerCastedFeedEventResolver`: Resolves `PollAnswerCastedFeedEvent` from `PollVoteCastedFeedEvent` or `PollVoteChangedFeedEvent`.
- `pollAnswerRemovedFeedEventResolver`: Resolves `PollAnswerRemovedFeedEvent` from `PollVoteRemovedFeedEvent`.
This provides a reactive way to interact with lists of data from Stream Feeds, automatically handling updates and pagination.1 parent bc302c5 commit 43e819e
File tree
61 files changed
+4643
-166
lines changed- packages/stream_feeds/lib
- src
- client
- event_resolvers
- poll
- models
- repository
- state
- event
- query
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
61 files changed
+4643
-166
lines changedLines changed: 79 additions & 30 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
| 8 | + | |
7 | 9 | | |
8 | 10 | | |
9 | 11 | | |
| |||
97 | 99 | | |
98 | 100 | | |
99 | 101 | | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
100 | 106 | | |
101 | 107 | | |
102 | 108 | | |
| |||
203 | 209 | | |
204 | 210 | | |
205 | 211 | | |
206 | | - | |
| 212 | + | |
207 | 213 | | |
208 | 214 | | |
209 | 215 | | |
| |||
219 | 225 | | |
220 | 226 | | |
221 | 227 | | |
222 | | - | |
223 | | - | |
| 228 | + | |
| 229 | + | |
224 | 230 | | |
225 | 231 | | |
226 | | - | |
227 | | - | |
228 | 232 | | |
229 | | - | |
| 233 | + | |
230 | 234 | | |
231 | 235 | | |
232 | 236 | | |
233 | 237 | | |
234 | 238 | | |
235 | 239 | | |
236 | 240 | | |
237 | | - | |
| 241 | + | |
| 242 | + | |
238 | 243 | | |
239 | 244 | | |
240 | 245 | | |
| |||
269 | 274 | | |
270 | 275 | | |
271 | 276 | | |
272 | | - | |
273 | | - | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
274 | 282 | | |
275 | 283 | | |
276 | 284 | | |
277 | | - | |
278 | | - | |
279 | | - | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
280 | 299 | | |
281 | 300 | | |
282 | 301 | | |
283 | 302 | | |
284 | | - | |
285 | | - | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
286 | 309 | | |
287 | 310 | | |
288 | 311 | | |
289 | 312 | | |
290 | | - | |
291 | | - | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
292 | 318 | | |
293 | 319 | | |
294 | 320 | | |
295 | 321 | | |
296 | | - | |
297 | | - | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
298 | 327 | | |
299 | 328 | | |
300 | 329 | | |
301 | 330 | | |
302 | | - | |
303 | | - | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
304 | 336 | | |
305 | 337 | | |
306 | 338 | | |
| |||
314 | 346 | | |
315 | 347 | | |
316 | 348 | | |
317 | | - | |
318 | | - | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
319 | 355 | | |
320 | 356 | | |
321 | 357 | | |
322 | 358 | | |
323 | | - | |
324 | | - | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
325 | 365 | | |
326 | 366 | | |
327 | 367 | | |
328 | 368 | | |
329 | | - | |
330 | | - | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
331 | 374 | | |
332 | 375 | | |
333 | 376 | | |
| |||
341 | 384 | | |
342 | 385 | | |
343 | 386 | | |
344 | | - | |
345 | | - | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
346 | 392 | | |
347 | 393 | | |
348 | 394 | | |
349 | 395 | | |
350 | | - | |
351 | | - | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
352 | 401 | | |
353 | 402 | | |
354 | 403 | | |
| |||
Lines changed: 76 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
Lines changed: 58 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
0 commit comments