-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Bootstrap: add initial state registration #21821
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
Conversation
MorrisJobke
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.
Code looks good 👍
4ea97c1 to
6d79509
Compare
| $context->delegateContainerRegistrations($apps); | ||
| $context->delegateMiddlewareRegistrations($apps); | ||
| $context->delegateSearchProviderRegistration($apps, $this->searchComposer); | ||
| $context->delegateInitialStateProviderRegistration($this->initialStateService); |
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.
#21828 might help make this even lazier
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.
#21828 might help make this even lazier
It's merged - ready to rebase this here and incorporate the changes :)
lib/public/IInitialStateService.php
Outdated
| * @param string $key | ||
| * @param Closure $closure returns a primitive or an object that implements JsonSerializable | ||
| * | ||
| * @deprecated 20.0.0 Use OCP\AppFramework\Services\InitialStateProvider |
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.
Do we want to deprecate the whole interface and only use InitialStateProvider?
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.
Providing state inline is still useful when it is not about global state but for example providing data in a controller method, so I'd prefer to keep the simple lazy approach.
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.
But for that we'd have OCP\AppFramework\Services\InitialStateProvider right?
Or do you have a different use case?
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.
Well if i need to provide some state in just one controller method (e.g. for my apps page route, i don't see why I should register a provider globally in the app bootstrap. Instead just registering it with provideLazyInitialState in the controller itself seems far more organized imo. Or am I missing something here?
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.
Ah sorry wrong interface OCP\AppFramework\Services\IInitialState
You can have that injected. AppID already set etc ;)
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.
Ah never mind then. 👍
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.
Okay, that means then that we can deprecate the whole interface?
6d79509 to
65b1c4d
Compare
|
Rebased to resolve conflicts. |
65b1c4d to
6f23181
Compare
|
Found some time to tackle this again... lets see |
|
🤖 beep boop beep 🤖 Here are the logs for the failed build: Status of 33613: failurecheckersShow full lognodbShow full logmariadb10.4-php7.4
acceptance-login
Show full log |
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
28dc290 to
b5fd75f
Compare
Covers basically
I'm not 100% happy with the location of the base class. But I could not come up with a better name just now.