OrchardCore icon indicating copy to clipboard operation
OrchardCore copied to clipboard

Widget Display Driver being called multiple times in Admin

Open marlon-tucker opened this issue 5 years ago • 10 comments

Using 1.0.0-beta3-70622

In our Orchard project, we have a fairly large amount of Widgets, most of which have to make external API calls to retrieve the data they need. Both when they are in their edit state as well as their display state.

When creating or editing a page, Orchard calls EditAsync on every DisplayDriver on every Widget that is currently active in the system. For us, this means all the external API calls happen if a page is created or edited (regardless if they are used on the page).

I assumed Orchard was caching these for when the user added the widget to the page, however, the EditAsync method is called again when that happens.

I realise our situation is unique, and Orchard was designed to have these methods read data from its own database, however it would be fantastic if this can be mitigated somehow. Either by removing the initial call to EditAsync as it does not seem like it is required? Or when that initial call happens, can a flag be present which can be checked, so we don't make external API calls unless required.

marlon-tucker avatar Feb 28 '19 15:02 marlon-tucker