Our pages are coded from more than one year, all was good. Last week a coding block at a simple enabling button request on Live Site. In preview Mode = No problem!
The problem seem to be : you code $w(“#myElement”).enable();
but this element is already enabled the code crash at this line on Live.
To solve the problem you need to code in that way : if ( $w(“#myElement”).disable ) {
$w(“#myElement”).enable();
}
Can add a else condition… like this
if( $w(“#myElement”).enabled ) {
$w(“#myElement”).disable();
}
else {
$w(“#myElement”).enable();
}
But a message to Wix experts coders. That make no sense!
Why enabling a button already enable now crash the code and only crash in Live ? because it was previously working… It took to me severals time to discover what’s wrong!
No matter the sate of a button, it make no sense that the code execution is broke for a simple request. code should execute this request with no break no matter if the code request element state is the same current element state.
disabled cause error, disabled is not a function in api list, enabled() yes but not disabled()… disable() all is good… No mor error in this page code! So please take care to provide good infos before comment!
Yes I could code in that way Thank you J.D I knew it. The goal of this post is not to debug my coding because all is working now, theres’ more than 6000 code lines in this page I think I can code correctly! So The goal of this post is to advise all about my encountered problem…
About… not 100% sure but this bug seem to happens only inside a async function with await…
I don’t think it’s a bug.
When you use await here, the code is supposed to stop until the promise gets resolved, but in this case it will never get resolved because it’s already in this state. This is how it’s supposed to work.