sean I did some further testing and it turns out that it wasn't a UI/JS bug.
When adding a new database, you get the option to select a PostgreSQL user which exists or have a new one automatically added. However, when I expand this list it is empty and I cannot select an existing user. The only option is to have a new one automatically created.
The problem was that the old user (of the deleted database) still existed, and when I tried to create a new database with the same name it also tried to automatically create a new user with the same name. This ends up being a duplicate, so the creation of the database is aborted. No warning/error messages are shown however.
When I manually deleted the old user I was able to reuse the database name again.