-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Bugfixes for MNTP / EntityController #11685
Bugfixes for MNTP / EntityController #11685
Conversation
Fixes issue with MNTP (for 8.18) in a partial view macro - GH #11631 Renamed GetUrlsByUdis to match, don't do this in v9 as it would be breaking there, instead mark it obsolete. TODO: v9 ensure integration test coverage, more painful here as no WebApplicationFactory.
This doesn't actually work in the backoffice because of GH #11448 So lets fix that next.
ParameterSwapControllerActionSelectorAttribute - cached body survived between requests.
Only store if deserialize success. Don't assume key being present means can cast as JObject.
@p-m-j I wonder if the issues I was facing with MNTP is in core as I didn't experienced these errors with MNTP in initial v9.0.0 release. I searched for changed in v9.0.1, but I couldn't find specifically something regarding MNTP and JSON changes. I wonder if these have any specific changes or could change/overwrite some JSON configuration? |
@bjarnef I'm not 100% certain this closes #11647 but #11448 was definitely a problem in core with ParameterSwapControllerActionSelectorAttribute.cs. From the gifs it certainly looks very similar to #11448 Edit: changing package versions is interesting as it requires app to restart, the issue with ParameterSwap was that the request body was cached across requests and restarting could make pages that didn't work before start to work. |
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.
Looks good and works as expected 💪
Will this be fixed in a patch of v9.0.x as well? Or do we need to upgrade to v9.1.x? Currently it is not possible to upgrade to v9.1 via Umbraco Cloud portal, so I guess we need to do this manually. What I think it as bit strange is that for the specific project I am working on I didn't had issues with MNTP in v8 or after migrated to v9.0.0, but after the project was patch updated. I couldn't see anything specific regarding this in v9.0.1 .. but besides that Locally I get some JSON exceptions as mentioned in #11647 |
@bjarnef Existing v8 sites wouldn't have issues with GetUrlsByUdi's as it has never and will never exist there, instead a call for GetUrlById was made for each entry in the MNTP. This method would have been introduced in 8.18 but now is replaced by GetUrlsByIds along with a bugfix for ParameterSwap attribute. These fixes are going into 9.1.2 I don't see how Cloud/Forms would impact modelbinding in CMS, imagine the restart is just clearing the cached request body in ParameterSwap attrbiute. |
@p-m-j I originally started the project on v8.15.1 and then migrated to v9.0.0, but I don't recall these issues with MNTP after migrating. |
Which issue there are two here. The introduction of GetUrlsByUdi to improve perf for MNTP was 9.1 #11207 (well this is the 8.18 version, it got merged into v9 some other commit) in and fixed in 9.1.2 |
@p-m-j okay, I will upgrade of the the project when v9.1.2 is out. However many existing projects on v9.0.0 or v.9.0.1 won't get this fixes automatically and requires manual action to get these bug fixes. Not sure why I didn't noticed any of these JSON exceptions when working on the project for a while on v9.0.0 though. |
@bjarnef WRT
It's not obvious unless you have both pickers for both int and udi mntp on same page (or just in the same site and have visited both pages) Steps to reproduce in 9.0.0
What's happening here is that the action constraint says yup I have a valid udi array here (from last request) you can use that action method, then modelbinding takes place and it says nope that's an int[] not a udi[] |
If you have multiple udi pickers, the contraint says yup can use that action method as request has array of udi's and modelbinding agrees. second request also works but the model binder and the action constraint were looking at 100% different strings so it's luck that it works. |
In this specific project it shouldn't be an issue with int id I guess, since it only store udi. The MNTP datatype instances are mainly multi picker and one or two pickers on a document type or a used on a single property in en block element. |
Closes #11631 & #11448.
Probably also closes #11647
If you follow manual reproducing steps from #11631
e.g.
--
If you also add a regular MNTP to the doc type - makes request GetUrlsByIds(Udi[])
Populate all the pickers with content, then you have covered testing for both issues at onces.