DamianEdwards/TagHelperPack

Can the asp-if tag helper's order be changed

danielgreen opened this issue · 2 comments

I am using the IfTagHelper with other tag helpers that have Order = 0 by default, and in this scenario I cannot change their Order.

Since the IfTagHelper's Order is set to int.MaxValue - 1, it runs after those other tag helpers, some of which do some work besides just populating the output.

For example they populate context.Items, and I would like to prevent them from doing so when the asp-if predicate is false.
This would require the IfTagHelper to run first, then the affected tag helpers could check SuppressedByAspIf or IsContentModified prior to populating the context.

Is there a reason why the order needs to be int.MaxValue - 1? Could it change to int.MinValue, or could we add a parameter such as asp-if-order to allow it to be overridden?

Secondary question - could the Authz tag helper expose a SuppressedByAuthz method?

I honestly can't remember why I made its order Int.MaxValue - 1. I'll take a look and see if it's as straightforward as making it < 0.