docbrown/app/assets/javascripts
Daniel Uber 6884a3d7f1
Clean up initializePage (#13236)
* Remove early call to setup local storage for user

The first thing the callInitializers function does is re-invoke
initializeLocalStorageRender, calling the same function twice (for a
different outcome?) seems like it's not effective.

I tried to trace down how long it had been that way, and came to the
very first commit in the repo -
301c6080e3, where the pattern already
existed, so it's unclear at what point (prior to 2018) this was added,
and what problem it was trying to solve.

If we inlined callInitializers (by renaming it initializePage and
deleting the bottom function), the duplication would be especially
evident. This is the only call site for callInitializers, which would
be the other reason we _might_ want to have redundancy.

* Inline function call

Since initializePage only acted as a new name for
callInitializers (immediately transferring control to the
callInitializer function), remove the wrapper function and rename
the *actual* code with the public name initializePage.

No logic/behavior should change, unless we were unit testing callInitializers.

* Shorten method by moving long list of logicless calls to a helper

"We don't want to make a habit of pandering to Code Climate and its
metrics blindly".

Appease the robot by moving about 20 lines of uninteresting sequential
code out of the initializePage function and into a "callInitializers"
function, which is also the name of the function I just inlined.
2021-04-12 09:57:40 -05:00
..
initializers Split Settings::Authentication from SiteConfig (#13095) 2021-04-12 09:41:09 +02:00
lib Provide skip links: Tweak skip link style, refactor main area ID (#12694) 2021-02-17 10:15:31 +00:00
utilities improve keyboard accessibility of modals 12427 10610 (#12511) 2021-02-24 16:01:10 +00:00
.eslintrc.js Replace globals with node env (#10767) 2020-10-14 17:05:38 -04:00
application.js Ran prettier on *.js, *.jsx and *.md files. (#11586) 2020-11-23 20:45:50 -05:00
base.js.erb Revert "Revert "Removed service worker (#12974)" (#13014)" (#13015) 2021-03-17 10:57:56 -04:00
initializePage.js Clean up initializePage (#13236) 2021-04-12 09:57:40 -05:00
internal.js Initial commit 2018-02-28 16:11:08 -05:00
jquery_s3_upload.js Ran prettier on *.js, *.jsx and *.md files. (#11586) 2020-11-23 20:45:50 -05:00