-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(core): add politeiagui toolkit #2869
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the toolkit-playground
app should be committed. Also, can you edit your PR to include the motivation to implement the toolkit for documentation? Code LGTM.
@tiagoalvesdulce Nice, I'll remove toolkit playground app. I used it as an example for this PR. Once I add the toolkit on pi app-shell, I'll update the description with the motivation. Thanks for the review 😉 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This PR adds the new politeiagui core toolkit, which exports the
createSliceService
util.Motivation
After defining some plugins services and their regarded setups for app
routes, I noticed that it's pretty hard to work with our previous setup flow
due to the following reasons:
There are lots of params property names definitions to keep in mind,
and it's easy to forget some name. Our error handler already gives us some
good dev feedback, but it's still hard to remember the configuration flow.
If we don't use any util to create slices services, it becomes hard
to maintain our standards between services configuration for plugins, and
services consumers.
Setting up a service requires devs to know all services
id
s in orderto consume them on app routes. Passing an invalid
id
as param throwsan error, but it's still hard to tell which service
id
is valid or not withoutlooking at each service configuration.
Lack of services slice configuration docs.
Solution
The
createSliceService
util formats our services to include on our pluginand to use them externally by setting up their services listeners.
Each service is composed by an
id
, used to identify the service among ourplugins and apps, an
onSetup
function to be executed when our service issetup, and an
effect
that will be executed for each Service Listener.Example:
Configure slice services:
Use on Plugin:
Consume services on app route: