Umbraco.Forms.Issues icon indicating copy to clipboard operation
Umbraco.Forms.Issues copied to clipboard

FieldPreValueSourceType - async GetPreValues

Open TheFogOfWar1 opened this issue 1 year ago • 2 comments

During development of a feature we came across PrevalueSourceTypes. These things complete cover our needs to provide custom data.

However we noticed that the GetPreValues function only available is in a Synchronous manner. We would like to see an asynchrounous option to be able to use async/await for getting data which we require.

In Umbraco it's becoming more and more common to use asynchronous notificationhandlers etc. Is this something we can expect in the (near) future.

TheFogOfWar1 avatar Aug 27 '24 12:08 TheFogOfWar1

Hi Wiebe! We've started gradually making the Forms API more async in each major version. Currently the controllers rendering/handling the form submissions, the views/components and the execution of workflows are all async (which are all called on each form render and submission, aka the 'hot path').

As you've discovered, the FieldPreValueSourceType doesn't have async support yet. However, the returned values can be cached since Forms 10.5+, as you can see in the updated screenshot in the v14 documentation. Can you give more context on why this would be beneficial in your specific implementation (what custom data are you requesting)?

ronaldbarendse avatar Aug 27 '24 14:08 ronaldbarendse

Internal note: have created work item 43587 to include this in the update to Forms 15.

AndyButland avatar Sep 04 '24 07:09 AndyButland

This method and some other appropriate ones will be asynchronous from Forms 15. The release candidate for this is expected next week.

AndyButland avatar Oct 03 '24 09:10 AndyButland