agdsn / pycroft

The AG DSN management system
Apache License 2.0
20 stars 9 forks source link

Account typeahead always prefetches system accounts #426

Open lukasjuhrich opened 3 years ago

lukasjuhrich commented 3 years ago

Since the account-typeahead is included in the main.js entrypoint, every statement in this module's top level is execited at all times. In particular, the prefetch for the system accounts completions is executed at all times.

The Bloodhound should be instantiated only when at least one field of the respective data-role exists (cf. lower in the file).

Context: account-typeahead.js

lukasjuhrich commented 3 years ago

Regardless of this issue, I don't think that we should include functionality like form completion in a bundle which we include synchronously with every request (in this case, main.js). Doing so is kind of a performance disaster (and unnecessarily bundle size is rightfully criticized by chrome's lighthouse and even a warning webpack reports when building).