Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

EXCEPTION: Attempt to use a dehydrated detector

See original GitHub issue


I’m currently using angular2-grid and when I move some of my items, I sometime have the error EXCEPTION: Attempt to use a dehydrated detector: DeviceDetails_2 -> itemChange coming.

This is the html part of my code concerning the display of the items:

<div class="row gray-bg" [ngGrid]="gridConfig">
    <div *ngFor='#widget of widgets; #i = index' [ngGridItem]="getGridInfo(widget)"
         (dragStop)="updateWidgets(i, $event)">
                <graph-widget [currentWidget]="widget"></graph-widget>
                <text-widget [currentWidget]="widget"></text-widget>

As you can see, I’m using dragStop to propagate the event and launch the following method:

    updateWidgets(i: number, pos: { col: number, row: number, sizex: number, sizey: number }) {
        var gridData = {col: pos.col, row: pos.row, sizex: pos.sizex, sizey: pos.sizey};
        var widgets = _.cloneDeep(this.widgets);
        if (this.isBreakpoint('sm') || this.isBreakpoint('xs')) {widgets[i] = gridData}
        else if (this.isBreakpoint('md')) {widgets[i] = gridData}
        else if (this.isBreakpoint('lg')) {widgets[i].reducedWidget.gridInfo.lg = gridData}

but the error mentions itemChange, why is that? The issue is certainly coming from the this.updated.emit(widgets); because when I comment that line of code, I don’t have any issue anymore. But, I need it to send my new widgets (which contains the position of each widget. to my store (I’m using redux).

Do you know what is a dehydrated detector exactly? And I can I deal with this issue? Any help would be really appreciated, thank you in advance!

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:16 (11 by maintainers)

github_iconTop GitHub Comments

LPalmitocommented, Apr 12, 2016

Actually I’ve made a wrong copy and paste you’re right, I’ve updated my comment in case someone is using the code I’ve written. In my real project I’m sending widgets to a reducer, which is in charge to update the this.widgets object. What can I say, I was tired when I copied and pasted it 😛 hahaha!

More seriously, I’ve an other issue I wanted to show you (the one I was talking about at the beginning actually!): Try that to reproduce it:

  • drag widget 1 below widget 2
  • use the reload button

The positions are reloaded appropriately, but the EXCEPTION: Attempt to use a dehydrated detector appears in the console logs. Do you see a way how I could reload the original positions without having this error?

BTMortoncommented, Apr 14, 2016

OK, scratch that. It looks like it’s because the event emitter is async and removing all the items at once causes a headache. The solution is just to use synchronous events for itemChange. It’s not ideal, I guess but it’ll fix it!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular2: EXCEPTION: Attempt to use a dehydrated detector ...
I'm having an issue in my ionic2/angular2 app. I'm building a quizz app, in which the user is prompted to answer questions, on...
Read more >
EXCEPTION: Attempt to use a dehydrated detector - Ionic Forum
Hi I've got some exception like this EXCEPTION: Attempt to use a dehydrated detector: AuthPage_1 -> blur Its happen when we use Loading ......
Read more >
EXCEPTION: Attempt to use a dehydrated detector - Ionic Forum
I have SAME 5 inputs and one of them doesn't work ). I replaced ([ngModel]) to [value] and it works. After this I...
Read more >
Error: "Caught Attempt to detect changes on a dehydrated detector ...
The issue happens when Angular internal data structures get into an invalid state. There were a couple of reasons where this could happen....
Read more >
code to handle any other I/O exception - CSE 331 Lecture Slides
In many cases, the best plan is to try to avoid exceptions. // better to check first than try/catch ... Use exceptions only...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found