-
Notifications
You must be signed in to change notification settings - Fork 27.4k
fix($templateRequest): always return the template that is stored in the cache #16434
Conversation
$templateCache
Just to be sure: doc's don't need to be updated for this PR, right ? I'm not sure if this really feels like a |
@frederikprijck - thanks once again for helping out with these fixes. I actually agree with you that this is really a bug fix (and arguably not a breaking change). At the moment it is inconsistent. Assuming that you have decorated
So, I would be happy to mark this as bug fix; but to be conservative we can mark it as BC and release in 1.7.0. |
I would really like to see a unit test for this that actually does decorate the |
For the commit message I would change it to the following, thinking about people who are searching for this in the changelog (not the
|
@petebacondarwin Regarding the test, would you really like a test that actually decorates it? Are there any other tests that actually do this kind of stuff? What about a test like this:
I'm not sure a test which actually decorates this would give any added value. Regarding bug vs feature, might be a good idea to re-label #16225 as well. |
This test looks fine to me :-) Thanks. |
…he cache Previously, `$templateRequest` returned the raw `$http` response data on the first request for a template and then the value from the cache for subsequent requests. If the value is transformed when being added to the cache (by decorating `$templateCache.put`) the return value of `$templateRequest` would be inconsistent depending upon when the request is made. This commit ensures the cached value is returned instead of the raw `$http` response data, thus allowing the `$templateCache` service to be decorated. Closes #16225
Since this is now not a breaking change, should it go into 1.6.x too? |
@Narretz Iirc this still is a BC... (This probably won't affect most users, but it will affect those already decorating the put call as mentioned #16434 (comment) ) |
Then there should have been a BC notice in the commit message :/ |
I'm going to let @gkalpak / @petebacondarwin reply to that. But apparently it's a fix, not a BC. I got a bit confused on the comments 🙈 |
It is a fix not a feature. I forgot to add a BC notice to the commit that I recommend to @frederikprijck - sorry for that - although one could argue that if you are decorating Putting it in 1.7.0 means that even if it did break someone's code then they would be aware that changes might need to be made and so would be more consciously testing rather than doing an automatic update, which might happen with 1.6.x updates. Let's add an issue to include a BC notice in the CHANGELOG when we release 1.7.0. |
What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
Fix
What is the current behavior? (You can also link to an open issue here)
Currently,
$templateRequest
does not return the cached version returned by$templateCache
. Instead, it returns the response retrieved from$http
. This makes it impossible to decorate$templateCache.put
as described in #16225 .What is the new behavior (if this is a feature change)?
This commit ensures the cached value is returned instead of the
$http
response, allowing for proper decorating.Does this PR introduce a breaking change?
Yes
Please check if the PR fulfills these requirements
Other information:
#16225