appronto / -Slide-In-Slide-Out-widget

A simple but effective widget to show extra optional information on a page, like notifications of the user or FAQ
0 stars 8 forks source link

Leaving the page where the widget is shown, causes Javascript engine to crash. #6

Closed heuvelb closed 5 years ago

heuvelb commented 5 years ago

Hi Joël,

I just spoke with Pim about the widget and he advised me to create an issue for the Slide Out (context) widget. The issue I'm facing is this:

Hopefully this provides some info, if I can be of service by showing the issue real-time with Skype, feel free to contact me (bart.van.den.heuvel@enexis.nl)

Edit: I've created a quick demo project to demonstrate this behaviour. Steps to reproduce the issue:

A dirty fix is done by myself by editing the buildstring function starting at line 219 in SlideOutContext.js.

_buildString: function (callback) {
            logger.debug(this.id + "._buildString");
            var str = this.buttonString,
                settings = null,
                attr = null;

            for (attr in this.replaceattributes) {
                settings = this.replaceattributes[attr];
                str = str.split("${" + settings.variable + "}").join(settings.value);
            }

            console.log(this.id + "._buildString: " + str);
            if (this.slidebutton) {
                this.slidebutton.innerHTML = str;
                this._setButtonTop();

                if (callback && typeof callback === "function") {
                    logger.debug(this.id + "._renderString callback");
                    callback();
                }
            }
    }

screenshot_1 screenshot_2 screenshot_3 screenshot_4 screenshot_5 screenshot_6 screenshot_7

TestWidget.zip

joelvdgraaf commented 5 years ago

The issue has to do, that the (Mendix) Javascript engine thinks that the previous widget still is alive and subscribed to that object an therefor each update is triggered. I'm searching how to unscribe the widget properly by an destroy event of the widget.

joelvdgraaf commented 5 years ago

New version 1.2.0 has been released in the appstore containing the fix for this issue!