jeudi 12 décembre 2019

Do I need to worry about the overload of importing big JSONs?

I have a js file which has an object like this:

const COL = {
  _UnitPositionID: {
        captionText: null,
        defaultValue: null,
        type: 'ComboBox',
        validation: null,
        render: getRender('_UnitPositionID', 'ComboBox'),
        directProps: {
            //...
            onKeyDown: (event) => getKeyDownSingleCharRestriction(event, type)
        }
    },
//and 1000 more properties
}  

But with almost 1000 of [ID]: {} structure, I create my components using a utility which calls upon this function and gets the validation, caption, defaultValue and ...
I did this because I use something like _UnitPositionID many times in my program (i have more than 300-400 forms!), so I created a structure such as this so i'm not forced to set a validation or ... each time I use one of these and so that I can simply say:

uility.createComboBox('_UnitPositionID')  

or

uility.createTextBox('PostalCode')   

and the component gets created

So here is my question, do I need to worry about the huge overload of imports ?, I mean the file has almost 10k line, and each component that wants some textbox or combobox will call my utility which will call this huge Map of mine that you just saw above.

Is this approach wrong? Any suggestion? Are there even any disadvantage to huge hard coded files such as mine?

Aucun commentaire:

Enregistrer un commentaire