Promises are Fulfilled Despite Their Requirements Were Not Met

As I said in a previous post , some promises that have requirement are being executed and fulfilled despite that their requirements were NOT met.

I have two issues right now:

  1. Auto scroll once the page is ready.

  2. Auto update a dataset once the page is ready.

Before diving into the issue, here’s a screencast demonstrating the two issues.

You can visit the page here .

Issue #1.

Auto scroll to the reviews repeater once the page is ready, and only when the user is logged in, all of the following code is executed which is strange.

$w('#EditReviewDataset').onAfterSave( () => {
    $w('#readReviews').refresh().then(() => {
        $w('#editReviewStrip').collapse().then(() => {
            $w('#reviewsRepeater').scrollTo();
        });
    });
});

Issue #2.

Auto update a dataset, and only when the user is logged in, for this issue, I really can’t show you any code since there is no single command that saves the dataset, and even the button that saves the data has no event handlers, there’s only a wixData.update() function but it’s for a completely different collection (DB).

NOTE: You need to be logged in in order to be able to reproduce these issues by yourself.

The first issue can be easily noticed, but the second issue was hard to spot, you need to check the (Last update time) of the review, it’ll always update to the current time you visit the page in.

The page code is very long, it’ll be so difficult for beginners to follow up with the code logic.

Help is appreciated.
Ahmad

It’s been almost a week since I asked this question, and two days since I opened a ticket at Wix Support, but yet I haven’t received any reply explaining this weird behavior.

I hope someone can explain!