I am using a map to load various layers, some of which are editable Feature Layers. The general idea is that my users will have access to a tool in the Template Picker if an editable layer has no features and the appropriate tool leaves the Template Picker if a feature is added for that layer. I am able to populate my Template Picker on load as expected based on which layers are loaded and if they already have more than zero features. The general algorithm is to allow my user to place a feature and then on draw-end, update my database and remove the corresponding tool from the Template Picker (or conversely, allow my user to delete a feature, which would update the database with the removal and then add that tool back to the Template Picker).
Best practices teach me that the best method in this case is to use the database as a source of truth for all operations. My plan then would be:
•user draws feature
•save changes to database
•solicit database to verify changes are in place
•update Template Picker accordingly
NBD, right? Except the QueryTask isn't reflecting the changes to the database. In troubleshooting this, I have placed a loop in the code to just eat up 30 seconds of time so I can go into my database access client and verify that the data has been removed from the database. Yet the Query comes back indicating the data still exists. It is not until I refresh the page that the change in the database is reflected by the Feature Layer in the browser.
(The loop I created has since been removed. It was for troubleshooting purposes only. Please do not get hung up on that part. That was a troubleshooting measure, not part of the code I am currently running.)
What could be causing this?