An exception occurred while executing 'SELECT user_id FROM _p.user WHERE user_name = :username LIMIT 1' with params ["Matthewrbowker"]: SQLSTATE[42S02]: Base table or view not found: 1146 Table '_p.user' doesn't exist
@Samwilson I'm assigning this to you, as it lies in your ProjectRepository code.
So I think these are all the scenarios when doing AJAX based on form changes:
- Changing the project updates any of:
- Page title
- Changing the namespace:
- Page title
I don't think we want spinners on every affected field, could be ugly :) So I propose we show the spinner on the field that triggers the AJAX (project or namespace, as applicable) and disable the affected fields until the AJAX is complete. How does that sound? @Matthewrbowker thoughts?
Drive-by suggestion: How about a slightly larger spinner in the screen center (on top of the form) if the loading isn't expected to take too long? Having some fields disabled might cause confusion and spinner on every field will definitely be ugly, like MusikAnimal noted.
If the loading will take long and people can fill up other form stuff meanwhile, then maybe not.
It won't be long, roughly one second if it's not cached. E.g. try changing the project at https://xtools.wmflabs.org/topedits. Right now only the namespace field is disabled, but the autocompletion JS is actually reinitialized on both the "Username" and "Page title" fields. We allow them to continue to typing but the results might all of a sudden change on keystroke.
Related, I think we should be caching the namespace API results for more than an hour. Probably more like a week? Changes to a projects' namespaces, API URL, etc., are very, very rare. Caching seems to make the loading time more or less instantaneous.
I think spinners are a good idea, direct feedback to the user quickly. I have no preference as to how it looks, although I would advise against making the form unusable if there's a failure in the processing.
I've updated the patch to show spinners within (at the right end of) the project, user, and page name fields, and removed the spinner from the namespace dropdown (because it's the change in the project input that makes that happen, so that's where the spinner is now).
See what you think.