tgxn / lemmy-modder

A moderation tool for Lemmy
https://modder.lemmyverse.net/
MIT License
12 stars 3 forks source link

Added search params to the Mod Logs and Approvals and reports page #123

Closed Pdzly closed 11 months ago

Pdzly commented 11 months ago

closes #118

This PR adds, to all pages search params, for users to save their filters.

tgxn commented 11 months ago

ideally, all of these settings would be tracked using the configReducer and saved to localStorage aswell, having these in state will make writing the filter UI easier - for example my UI for searching for users will just have to dispatch to config instead of passing parameters

tgxn commented 11 months ago

maybe we have a seperate reducer for anything that is ephemeral, and shouldn't be saved in localStorage...

Pdzly commented 11 months ago

I didnt do that because then it would be not the "React way". As then i would need to use native functions. And we would need to check if it will create a infinite loop. Because => dispatch event => changes url search params => the search params gets "changed" => dispatch event => repeat

Because you cant use react hooks in redux actions

Pdzly commented 11 months ago

Ohh now i understood you. But that is not the reason why the url search params are there. Its for sharing to others, bookmark multiple filters.... if i understood you now correct

tgxn commented 11 months ago

yeah sorry this looks great @Pdzly :) srry i've been sidetracked the past few weeks 😑

i think i was asking this so that we can have other elements control the state, but it looks fine 😊

Pdzly commented 11 months ago

Thanks!