-
-
Notifications
You must be signed in to change notification settings - Fork 835
Ebrehault listing block #7603
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
base: seven
Are you sure you want to change the base?
Ebrehault listing block #7603
Conversation
|
I changed the base branch to |
oops, sorry |
sneridagh
left a comment
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.
@ebrehault sorry for taking so long to take a look!
It does look good for me so far!
Regarding the typings, I agree the current types are as baseline, we never have been exhaustive on defining them, and we are completing them "on the fly". I am not a TS expert at all, I would leave that to others that know more than me in that regard :)
apps/seven/app/root.tsx
Outdated
| cli.getSite(), | ||
| ]); | ||
|
|
||
| const listingBlocks: { id: string; block: ListingBlockFormData }[] = |
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.
yes, this was the idea, however in the future we should have a generic "visitor" that executes specific extra calls if needed. Using an utilitity for that then call them all and execute them like the rootLoaderDataUtilities.
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.
@sneridagh ok, done :)
I was not very comfortable using a very loose typing for the utility method ((...args: any[]) => any), so I have created a more precise typing, and default to the original as DummyUtilityMethod.
That way, you can do things like:
config.getUtilities<ContentSubRequestUtilityMethod>({
type: 'rootContentSubRequest',
});
and you know for sure what you get.
That's safer.
Ideally, we should bind the typing with the utility type, like when calling getUtilities with type: 'rootContentSubRequest' then we should mandatorily obtain some ContentSubRequestUtilityMethod, but that would change the setUtility and getUtilities signatures, so maybe that should be done in another PR.
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.
That's great! We were wondering if we could infer that that automatically in utilities, but this is sufficient, for sure.
Let's do this in another PR, yep.
9764b29 to
f13980d
Compare
|
I think my PR is ready. Last questions:
|
Naive implementation.
Comments:
apps/seven/app/root.tsx, not sure if that's accurateBlocksFormDatatype as followed:That way we can have a specific typing for each type of blocks instead of having one generic interface with a very unhelpful
[x: string]: unknown;.DummyBlockFormDatais there for now as the other specific block types are not existing yet, but it is meant to be removed once everything is properly typed.📚 Documentation preview 📚: https://plone-registry--7603.org.readthedocs.build/
📚 Documentation preview 📚: https://volto--7603.org.readthedocs.build/