-
-
Notifications
You must be signed in to change notification settings - Fork 28
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
View in inconsistent state when Dynamic block throws an exception!!! #81
Comments
You can use 'view.defineRoot()' |
Thank you @3t-service for your feedback. Indeed, for that example of partial we cannot directly invoke Regarding your second alert about wrong use of That sample was copied from the following unit test, which I can run without any problem. I am sorry for any annoying about the documentation, I understand your trouble with that. But we are just a few developers maintaining this library and we are always giving priority for new features rather than improving docs. |
I have found a way to replicate You are already in a dynamic block exception. Here I have defined a dynamic block which adds p tags from a HashMap. `HtmlView<HashMap<String, Object>> view1 = DynamicHtml.view(Main::taskDetailsTemplate);
}` |
Great catch @3t-service! There is a bug indeed in dynamic processing that is not dealing with the case where the dynamic block throws an exception leaving the view in inconsistent state. Regarding your previous comment about:
You are right too. The unit test for this documentation had render in comment and I was not running the template. There is a mistake in the template and we have to replace nested Regarding the bug in dynamic I will have to plan a fix, since it requires changes in HtmlApiFaster dependency. |
I am currently using a workaround where I wrap the view calls in a try statement and recreate the view in case of an exception. |
Looking at https://htmlflow.org/features/ for partial template
static void template(DynamicHtml<Pet> view, Pet pet) { view .form().attrMethod(EnumMethodType.POST) .div().attrClass("form-group has-feedback") .dynamic(div -> view.addPartial(InputField.view, InputField.LV.of("Date", "date", LocalDate.now()))) .__() //div .__() //form``` )
DynamicHtml<T> view
does not contain the method form().The method form() is undefined for the type DynamicHtml
html div and tr exist. I'm using 3.0.2. Is there a work around?
I am trying to make a template for head() but this does not exist. The only way to access head is via: html().head()
The text was updated successfully, but these errors were encountered: