AdminUsersFeature FormLayout Customization Caching

I am using a FormLayout Customization of the AdminUsersPlugin. In that customization, I am populating the Allowable Values of an HTML Select element from an external source as follows:

       FormLayout = new()
        {
            Input.For<MyUser>(x => x.Email, x => x.Type = Input.Types.Email),
            Input.For<MyUser>(x => x.FirstName, c => c.FieldsPerRow(2)),
            Input.For<MyUser>(x => x.LastName, c => c.FieldsPerRow(2)),
            new InputInfo("RowLevelPermissionsGroup", "select")
            {
                Css = null,
                AllowableValues = PremissionsRepository?.ListPermissionGroupNames().ToArray(),
            },
        };

This works great. However, if new values are added to the external source ( PremissionsRepository ), the select control does not update on browser refresh. Restarting the host shows the new item. I am wondering if there is caching behind the scenes with the petite-vue.js implementation in the Admin Users Feature that would account for this behavior.

FormLayout and AllowableValues you’re populating are just normal properties that’s populated when the plugin is configured once on Startup, i.e. it’s not a lambda that’s recalculated per request.

You’ll need to explicitly modify the collection to change it after it’s updated, e.g:

HostContext.GetPlugin<AdminUsersFeature>().FormLayout
    .First(x => x.Id == "RowLevelPermissionsGroup").AllowableValues = ...

Or you can dynamically populate it each time the App Metadata is requested (i.e. page is refreshed):

appHost.ModifyAppMetadata((req, meta) => {
    var premissionsRepo = req.TryResolve<IMyPremissionsRepo>();
    meta.Plugins.AdminUsers.FormLayout.Find(x=>x.Id=="RowLevelPermissionsGroup")
        .AllowableValues = premissionsRepo.ListPermissionGroupNames().ToArray();
});