-
Notifications
You must be signed in to change notification settings - Fork 10
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
Combination of nova-json-wrapper and conditional-container does not work #15
Comments
Hi this error |
Like I said, I followed the example in #10. This is the exact contents of my classes:
I still get the error and the |
ConditionalContainer cannot depend on a property thats set as its parent.. for example this will not work: JsonWrapper::make('Target', [
Boolean::make('Collection'),
ConditionalContainer::make([])->if('target.collection truthy true')
]); Because ConditionalContainer is a child of JsonWrapper (this limitation has to do with how the Vue components are created once the payload is sent to the frontend, JsonWrapper is created before ConditionalContainer has a chance to modify it) This would be the correct way of having this dependency: JsonWrapper::make('Target', [
Boolean::make('Collection'),
ConditionalContainer::make([])->if('collection truthy true')
]); But I'm unsure if this would work as intended.. due to that JSON wrapper modifies the name of the collection which would confuse the conditional container... try to dd() this line nova-json-wrapper/src/HasJsonWrapper.php Line 79 in db092d7
->if(name truth true )
|
It seems like line does not run at all... I have tried using
It looks like the use-case in the README.md is the same as mine. It also has Are you sure this has nothing to do with either my Nova version (3.21.0)? Or a conflict in the |
Try to dd the output this function nova-json-wrapper/src/JsonWrapper.php Line 165 in db092d7
Yes it did work, my main point was that you can not depend on a value like this |
The name seems to simply be I have created a small I can create a However, the See the code examples below. Workingclass TestHighlight extends UseJsonWrapperAndConditionalContainer
{
public static $model = \App\Highlight::class;
public function fields(Request $request)
{
return [
Boolean::make('Toggle'),
ConditionalContainer::make([
Text::make('True'),
])->if('toggle truthy true'),
ConditionalContainer::make([
Text::make('False'),
])->if('toggle truthy false'),
JsonWrapper::make('Test', [
Text::make('Json'),
]),
];
}
} Not workingThis examples give the class TestHighlight extends UseJsonWrapperAndConditionalContainer
{
public static $model = \App\Highlight::class;
public function fields(Request $request)
{
return [
Boolean::make('Toggle'),
JsonWrapper::make('Test', [
Text::make('Json'),
ConditionalContainer::make([
Text::make('True'),
])->if('toggle truthy true'),
ConditionalContainer::make([
Text::make('False'),
])->if('toggle truthy false'),
]),
];
}
} |
I think I found a fix for this, can you try version |
Fixed on version |
I can confirm that the errors have been resolved. Thank you for you quick responses! |
Hi 👋,
I have implemented my resource by extending the abstract class
UseJsonWraperAndConditionalContainer
as suggested in #10.However, combining the
JsonWrapper
andConditionalContainer
does not work. On the front-end, I get the following error:TypeError: this.field.expressionsMap is undefined
. This error does not occur when I remove theJsonWrapper
(but keep extending the same abstract class).I read somewhere that this might be caused by incompatibility with Nova version 3.
Are there any plans to add support for newer Nova versions? We are currently using version 3.21.0.
Thanks!
The text was updated successfully, but these errors were encountered: