bugzilla.mozilla.org will be intermittently unavailable on Saturday, March 24th, from 16:00 until 20:00 UTC.

Preload supersearch fields as part of rendered document



2 years ago
2 years ago


(Reporter: peterbe, Unassigned)


Firefox Tracking Flags

(Not tracked)




2 years ago
When loading the supersearch page, it first loads, with AJAX, all the fields
It's a 26Kb JSON document (get's gzipped). 

But why are we doing that? It never changes. If we could instead get the fields loaded and embed them into the DOM (data attributes or an inline <script> tag) the page doesn't have to wait for a AJAX request to load and finish until the page is ready to be used.

Comment 1

2 years ago
Adrian, Any reason we can't do that fields query as part of the loading of the view server-side?
Flags: needinfo?(adrian)
That was an architectural decision in order to make ``dynamic_form.js`` an independent module that could be used outside of Socorro. I believe the simple solution here would be to add some advanced caching to the JS client so that that fields list is not loaded every time.
Flags: needinfo?(adrian)

Comment 3

2 years ago
The contents of it is 26Kb (last time I looked). You probably don't want to store that in localStorage or sessionStorage. (It fits but will cause slowness in the browser). 

I suggest you consider doing something like `<script>var FIELDS={{ json_print(all_fields) }};</script>` in the HTML.
You need to log in before you can comment on or make changes to this bug.