agc93 Posted May 28, 2020 Share Posted May 28, 2020 Figured I'd open a topic here for discussion rather than clog up GitHub with wild fancies: Is there any chance we might see an API in future for extensions to manage extension-specific or game-specific settings without having to build out all the moving parts that currently requires? --- For context, I have almost no experience with React and have never used Redux (or any observer pattern designs, realistically). To have a single boolean flag that a user can change currently requires: A React component to register with registerSettingsCreating a new action (I think)Creating a new reducer (possibly with the ability to merge existing state?)Wiring up the Settings component to the state store, and to the new action (this is super confusing for new people) Having now spent about 4 hours working on that, the last step isn't working for me and the whole thing is approaching "too hard" territory. --- My ideal scenario would be that an extension could register very simple preferences (maybe only booleans or strings), using a simplified API that could be shown in the Settings page. Essentially something similar to how profile features are implemented, but not profile-specific for simple toggles. Is this something there might be interest in? Blockers I'm not thinking of? Just trying to throw out an idea here based on a pain point I've had. Link to comment Share on other sites More sharing options...
Tannin42 Posted May 29, 2020 Share Posted May 29, 2020 This is actually on my to-do list, yes. Unfortunately not necessarily highest priority. I actually have an entire zoo of improvements I'd like to do to the api but just can't find the time for. If you want I can take a look at your code. Link to comment Share on other sites More sharing options...
agc93 Posted May 30, 2020 Author Share Posted May 30, 2020 Awesome! That would really make building out extension functionality a lot easier if I could reliably do settings without having to build all the parts myself :)As for my code specifically, if you get a chance it's been pushed to agc93/beatvortex , but the actual register call has been commented out since it blows up the moment I try and change a setting. Link to comment Share on other sites More sharing options...
Tannin42 Posted May 31, 2020 Share Posted May 31, 2020 I just made a pull request that would fix the problem: https://github.com/agc93/beatvortex/pull/3 The main problem was that you export both the original OneClickSettings class (by name) as well as the one wrapped by connect (as default), when you import you use the original class which therefore isn't connected to the store at all. This is maybe the misunderstanding: connect doesn't modify the class it is used on, it instead creates a new one with added functionality. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.