Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: Slidebox pull to refresh Error: read only property #3589

Closed
uofmmike opened this issue Apr 22, 2015 · 7 comments
Closed

bug: Slidebox pull to refresh Error: read only property #3589

uofmmike opened this issue Apr 22, 2015 · 7 comments

Comments

@uofmmike
Copy link
Contributor

Type: bug

Platform: ios 8 webview

Ion-slide-box inside ng-repeat throws an error on a pull to refresh, happens when attempting to reassign an object in the scope. ex: Resetting total posts count to 5 after having a long post list.

I attempted to wrap in timeouts to see if that would mitigate, it did not.
it appears to only happen when there is an ion-slide inside the slidebox (aka if you fake a slidebox without a slide, there is no issue)

It appears to be related to (or the same as?) this angular issue:
angular/angular.js#9128

iOS 8.3(12F70) iPhone 6+
Error does not present itself in browser, only on iOS

Error Thrown:

459386   error    Error: Attempted to assign to readonly property.
kill@http://10.0.1.8:8100/lib/ionic/js/ionic.bundle.js:8473:24
http://10.0.1.8:8100/lib/ionic/js/ionic.bundle.js:54243:20
$broadcast@http://10.0.1.8:8100/lib/ionic/js/ionic.bundle.js:23406:33
$destroy@http://10.0.1.8:8100/lib/ionic/js/ionic.bundle.js:23026:24
ngRepeatAction@http://10.0.1.8:8100/lib/ionic/js/ionic.bundle.js:33160:33
$watchCollectionAction@http://10.0.1.8:8100/lib/ionic/js/ionic.bundle.js:22796:21
$digest@http://10.0.1.8:8100/lib/ionic/js/ionic.bundle.js:22929:31
$apply@http://10.0.1.8:8100/lib/ionic/js/ionic.bundle.js:23192:31
http://10.0.1.8:8100/lib/ionic/js/ionic.bundle.js:24918:42
completeOutstandingRequest@http://10.0.1.8:8100/lib/ionic/js/ionic.bundle.js:13591:15
http://10.0.1.8:8100/lib/ionic/js/ionic.bundle.js:13971:33
```</span>

<span is-issue-template></span>
@scripterkaran
Copy link

Please provide code so we can debug.

@uofmmike
Copy link
Contributor Author

Surely, sorry should have done that to begin with!

To remove the error, replace the slidebox in the example with anything, or nothing. error thrown when pulling to refresh.

Thanks!

Inline is the same as this codepen: http://codepen.io/mmullins/pen/BNaVJv

angular.module('starter.controllers', []).controller('DashCtrl', function($scope) { 
    $scope.refreshFeed = function() {
        //pause the infinite
        $scope.$broadcast('scroll.infiniteScrollComplete');
        $scope.noMoreItemsAvailable = true;

        //reset the array (0,1 is an exaggeration but causes a failure)
        $scope.items = $scope.items.slice(0, 1);
        $scope.$broadcast('scroll.refreshComplete');

        //would allow continue of infinite
        //$scope.noMoreItemsAvailable = false;
    };

    $scope.noMoreItemsAvailable = false;

    $scope.loadMore = function() {
        $scope.items.push({
            id : $scope.items.length
        });

        if ($scope.items.length == 99) {
            $scope.noMoreItemsAvailable = true;
        }
        $scope.$broadcast('scroll.infiniteScrollComplete');
    };

    $scope.items = [];

});
<ion-view view-title="Dashboard">
    <ion-content class="padding">
        <ion-refresher
        on-refresh="refreshFeed()"></ion-refresher>
        <ion-list>

            <ion-item ng-repeat="item in items"
            item="item"
            href="#/item/{{item.id}}">
                <ion-slide-box >
                    <ion-slide>
                        <div class="box blue">
                            <h1>BLUE</h1>
                        </div>
                    </ion-slide>
                    <ion-slide>
                        <div class="box yellow">
                            <h1>YELLOW</h1>
                        </div>
                    </ion-slide>
                    <ion-slide>
                        <div class="box pink">
                            <h1>PINK</h1>
                        </div>
                    </ion-slide>
                </ion-slide-box>
            </ion-item>

        </ion-list>
        <ion-infinite-scroll ng-if="!noMoreItemsAvailable" on-infinite="loadMore()" distance="10%"></ion-infinite-scroll>
    </ion-content>
</ion-view>

@rhespy
Copy link

rhespy commented Apr 25, 2015

I see the same error in the kill function on this line of ionic.js:

//reset slides so no refs are held on to
slides && (slides.length = 0);

It looks like slides.length is read-only so an error is thrown.
If I comment out that line, the error is not thrown.

@rhespy
Copy link

rhespy commented Apr 29, 2015

This update did not fix the issue for me.
I still get the same "read-only property" error.

@pixnlove
Copy link

The commit did not fix the issue for me too.

@campers
Copy link

campers commented May 2, 2015

@perrygovier looks like there was a mistake in the commit, fredgalvao added a note in the commit with what looks to be the correct change
08956b2

@perrygovier
Copy link
Contributor

wow, yeah. that'll teach me to commit a fix quickly on my way out the door. Thanks

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Sep 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants