daybrush / moveable

Moveable! Draggable! Resizable! Scalable! Rotatable! Warpable! Pinchable! Groupable! Snappable!
https://daybrush.com/moveable/
MIT License
10.08k stars 618 forks source link

Crash of ngx-moveable when using --prod on angular #129

Closed JulesVi closed 4 years ago

JulesVi commented 4 years ago

Hello, image I have a problem only on prod mode on angular (0.9.1) : When I use the change detection with a ngif, when it has to run the ngx-moveable module, the module crash in loop has the error here

daybrush commented 4 years ago

@JulesVi

Can you give me an address to test? Or give me code to test.

I've tested it but it doesn't work.

 <ngx-moveable
      #moveable
      *ngIf="resizable"
      [target]="target"
      [draggable]="true"
      [origin]="false"
      [rotatable]="true"
      [pinchable]="true"
      [scalable]="scalable"
      [resizable]="resizable"
      [warpable]="warpable"
      [keepRatio]="false"
      [throttleDrag]="1"
      [throttleScale]="0.01"
      [throttleRotate]="0.2"
      [throttleResize]="1"
      (drag)="onDrag($event)"
      (resize)="onResize($event)"
      (scale)="onScale($event)"
      (warp)="onWarp($event)"
      (rotate)="onRotate($event)"
      (pinch)="onPinch($event)"
      (dragEnd)="onEnd()"
      (resizeEnd)="onEnd()"
      (scaleEnd)="onEnd()"
      (warpEnd)="onEnd()"
      (rotateEnd)="onEnd()"
      (pinchEnd)="onEnd()"
      >
    </ngx-moveable>
"@angular/animations": "~9.0.0-rc.7",
    "@angular/common": "~9.0.0-rc.7",
    "@angular/compiler": "~9.0.0-rc.7",
    "@angular/core": "^9.0.0-rc.7",
    "@angular/forms": "~9.0.0-rc.7",
    "@angular/platform-browser": "~9.0.0-rc.7",
    "@angular/platform-browser-dynamic": "~9.0.0-rc.7",
    "@angular/router": "~9.0.0-rc.7",
JulesVi commented 4 years ago

Hello, thanks for your answer. I explained my problem the wrong way : I am on angular 8, but I have the problem of crash with Ngx-Moveable 0.9.2, and I use this in my code to avoid to much detections : ngAfterViewInit() { setTimeout(() => { this._cdRef.detectChanges(); }); } Maybe it can be linked and cause trouble on prod mode ?

daybrush commented 4 years ago

@JulesVi

I tried to try but it doesn't work.

Can you help me? https://github.com/daybrush/movable-angular-error

JulesVi commented 4 years ago

I tried to reproduce it on other projects but it didn't happn so I will come back to you when I manage to reproduce it frequently

daybrush commented 4 years ago

@JulesVi

I'm not sure why. do try npm ci

JulesVi commented 4 years ago

Hello, I noticed something : with using an old version (0.5.7 and before) of ngxMoveable, it works perfectly, even on prod mode (angular 8.2), But when I come back to a newer version, it still make the "P is not a function" and signal errors on Preact (I am on Angular) I hope it can help you

daybrush commented 4 years ago

@JulesVi

Can you show me formatted code : main.***.js:1:8179 and "__e", "T", "preact_module_b"

JulesVi commented 4 years ago

The console show that this code seems to be problematic

error.js.txt

daybrush commented 4 years ago

@JulesVi

A new version has been released.

Update to the new version. Thank you :)

JulesVi commented 4 years ago

Hello, Thanks for your hard work but after testing, reinstalling modules etc, it still the same error But now it concern "moveable esmb" image

JulesVi commented 4 years ago

Here is the code linked to the error

error2.js.txt

Hope it can help

daybrush commented 4 years ago

@JulesVi This problem seems to be difficult to solve the problem over without removing preact. I think it will need to replace preact and it will take a little longer. Thank you.

JulesVi commented 4 years ago

Okay I understand, thank you !

daybrush commented 4 years ago

@JulesVi I worked to remove the problem preact and released the next version. Would you like to test with the next version?

$ npm i ngx-moveable@next
JulesVi commented 4 years ago

Hello, thanks a lot, it is no more crash ! I share you this project https://github.com/JulesVi/BugsDragResize where you can see with activating and moving the tiles that only the first one is wrapped by the module (only one 'control box' created on the HTML), the other are created but not wrapped by a control box (not created)

JulesVi commented 4 years ago

Hello, do you have any update ? Thanks

daybrush commented 4 years ago

@JulesVi

I will update it this week.

daybrush commented 4 years ago

@JulesVi

Moveable 0.14.0 is released. Thank you :)

JulesVi commented 4 years ago

Hello, sorry to reOpen the issue, but after the updates of the module, I tried on the project that I shared to you before, but it is not resolving the problem : Only one tile is moving, not the others wich are created in the same time.. I share to you the link of the project : https://github.com/JulesVi/BugsDragResize

Thanks

daybrush commented 4 years ago

@JulesVi

Maybe duplicate #189 #187

JulesVi commented 4 years ago

This seems to be the same problem, thanks

JulesVi commented 4 years ago

Update: Your update worked very well to make all the tiles moving, but when I want to quit the "edit" mode, the moveable element doesn't disappear. When I want to edit again, it creates a new moveable element (on the same project that I have shared before)

daybrush commented 4 years ago

@JulesVi

This is a react-simple-compat issue and I've updated it once more. Check it again.

https://github.com/daybrush/react-simple-compat

JulesVi commented 4 years ago

This is perfect, thanks a lot for your work !