I'm building what basically amounts to a GeoForm where users will be prompted to create a polygon and a point feature for their survey response. I am using the Editor Widget to do this and I'm beginning to understand the different workflow sections that are initiated at each point of the create and update workflows. For this survey, we'd like users to only submit one type of each feature geometry. My attempt can be described as follows:
Use the whenLayerView() method on the point and polygon layers. If the layer loads successfully, with each mouse click check the amount of records, if the amount of records is equal to 1, turn off the adding capability for that layer.
I can tell this isn't a great way of doing what I want as it doesn't update the layerInfos quickly enough by the time the workflow repeats back to stage 1 after the initial feature addition. I suppose that when the user clicks the "add" button of the editor that the current creationInfo isn't being refreshed for the editorViewModel? Usually once the workflow has been changed back and forth from create to update, I can see the new layerInfos updating and removing my creation abilities for that layer. This provides far too much wiggle room however and simply won't do.
Is there a simple way to catch when a feature is being updated, prevent more inputs until the feature has updated, then refresh the editor to display the new creation abilities?
Any advice for how I should proceed or a better way to approach this problem? Thanks!