can I disable autDestroy on lightning component. Currently in higer version api than 39 customComponent().autoDestroy(false) not working.

I need storage dynamicly created lightning component. This is posible?


Case - Open tab and open created form field, user can fill part of them without saving he can go to another component and back to my component.

In version 37 api everything working properly but when i switch to 43 api i have js exception with information:

Error in $A.getCallback() [newEntry.autoDestroy is not a function]↵Callback failed:

In api 43 I see that object: enter image description here

In documentation from aura autoDestroy() is still there - so i'm a litle confused.

  • How is it "not working"? Can you please provide a working demonstration of what you've tried so far? Any error messages? The more information you give us, the better we can help you. You can edit your question to include additional information. – sfdcfox Jun 14 '18 at 18:13
  • @JJanek please can you provide example code? – Robs Jun 18 '18 at 14:37

As stated in documentation dynamically created components should not be getting automatically destroyed. To destroy it you need explicitly call destroy method on component.

Please refere to this link https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/js_cb_dynamic_cmp_async.htm


Well i may suggest a workaround... To use localstorage for storing user inputs... Once the component is rerenderd, you may look at the browser's localstorage to prefill the data/form.

You can clear the localstorage once save is successful.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.