2 ms·
I built a Vue.js component for a Rails form that had tons of hidden fields and we couldn't figure out why it was grinding to a halt and lagging only on my bosse
by dmix 7y ago
I built a Vue.js component for a Rails form that had tons of hidden fields and we couldn't figure out why it was grinding to a halt and lagging only on my bosses machine.
Turns out it was Lastpass and using their lp-ignore flag didn't do anything since it was loaded after the fact.
We ultimately decided to just have an advisory to tell people to disable Lastpass if it came up. Which involves going to the Account settings page and adding a 'Never URL' https://support.logmeininc.com/lastpass/help/disable-lastpass-for-specific-sites-lp040006 https://support.logmeininc.com/lastpass/help/disable-lastpas...
- katsura 7y agoI had a very similar experience. I couldn't understand why doing certain events was so slow in Chrome, but not in Firefox. After a lot of debuggin I realized that LastPass was the culprit. If you add and remove a lot of input fields your page is going to slow down considerably, and there `lp-ignore` attribute didn't help at all.
- dmix 7y agoI’ve had chrome extensions slow things down before but never this badly. It was crazy. You can tell they are using extremely inefficient JavaScript to track form fields. And hire shitty developers who cant figure out a proper flag to add to be ignored. Very anti internet IMO.
- gremlinsinc 7y agoCurious why all the hidden fields though? Seems like an anti-pattern. I haven't used a hidden field in years. I mean props if using server passed data would easily pass the data to your vue context. I don't even use <form> tags anymore. just bind everything to a json object and transform the data as needed if combining stuff then send it off to the api on-click. Saves some work because I don't have to use the prevent tag in the form element or worry about the submit button binding. I just add an @click to a normal button element and use axios w/ some modifications to enable our auth scheme. (Headers and what not).
- dmix 7y agoI'm building very complex B2B software (link to company is in profile) doing phone call tracking and its a large legacy Rails app with standard `form_for` type forms. On one page there could be hundreds of records because some customers like to create a thousand objects for one marketing 'campaign' and have customers routed (via IVR or geo or other flags from the source website/ad embedded js) to a thousand different sales agents depending on fine-tuned criteria (like if they press 1 to say they are over 50), and from there it could trigger a hundred different conversion triggers (for ex: to do CPA payouts to the traffic sources) and webhooks to various analytics services. Anyway I'm slowly redesigning each part of the giant forms one-by-one and instead of AJAXing some parts separately I'm injecting the data into hidden fields which get submitted via traditional HTTP form-data along with the old forms. I built a Vue component that automatically generates Rails friendly forms from any object. Including nested arrays of objects, with any degree of nesting. I plan on publishing it soon OSS as RailsForm.vue. It sounds crazy but it was actually really simple to do and is only a temporary transitional thing. The only problem is I'm pushing the limits of browser memory/CPU on some customer accounts so I've made some performance optimizations like only rendering the hidden fields once the submit button is pushed.