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 report] Uncaught TypeError: Cannot read properties of undefined (reading '0') Source Error Model #1110

Open
ndoteddy opened this issue Nov 1, 2024 · 0 comments

Comments

@ndoteddy
Copy link

ndoteddy commented Nov 1, 2024

REQUIRED: Before filing a bug report

Change each [ ] to [x] when you have done it.

Describe the bug (required)

A clear and concise description of what the bug is. What did you do, and what
did you expected to happen? What happened instead?

To Reproduce (required)

Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

If your issue appears in a larger codebase and it you can't pin down why it is
happening, please

  • Fork this StackBlitz template
  • Update it to the latest ng2-dragula
  • Modify it, and reproduce the issue
  • Add a link to it here.

Screenshots (optional)

SourceModelIssue

If applicable, add screenshots to help explain your problem.
<div [dragula]="'WorkOrder'" [(dragulaModel)]="day.WorkOrders"
class="__gridCellContainer"
[attr.data-row-id]="rowId" [attr.data-cell-id]="cellId"
[attr.data-tech-id]="tech.SapId" *ngIf="day.WorkOrders">

<work-order *ngFor="let workOrderEntry of day.WorkOrders; index as cellIndex"
[selectedWorkOrders]="selectedWorkOrders" ...... >

For normal flow its working fine but when something occured in the child component (e.g something change/updated)
we notice the placeholder of the "container" is totally change and drake unable to match the container with newly updated container (we also have put change detection to ensure the cycle being refresh)

Versions (required)
Version : 5.1.0
https://www.npmjs.com/package/ng2-dragula/v/5.1.0

Please state which versions of the following packages you have installed:
"@angular/core": "^18.2.9",
"ng2-dragula": "^5.1.0",

Browsers affected (optional)
Microsoft Edge

Is this a bug in a particular browser? If so, it's unlikely that it's a problem with ng2-dragula. Instead, it is probably a bug in dragula.

Additional context (optional)

<div [dragula]="'WorkOrder'" [(dragulaModel)]="day.WorkOrders" (dragulaModelChange)="WorkOrder = $event" class="__gridCellContainer" [attr.data-row-id]="rowId" [attr.data-cell-id]="cellId" [attr.data-tech-id]="tech.SapId"> <work-order *ngFor="let workOrderEntry of day.WorkOrders; index as cellIndex" [selectedWorkOrders]="selectedWorkOrders" [selectedWorkOrdersForMove]="selectedWorkOrdersForMove" [grid]="grid" [weekDays]="weekDays" [rowId]="rowId" [cellId]="cellId" [cellIndex]="cellIndex" [workOrderEntry]="workOrderEntry"

We are using NG2-Dragula but for some cases we found the bug inside the ng2-dragula
when the source of model is undefined eventhough we have define it in angular template as above

the issue has occured before drop event being hit -
and because source model undefined its throw unhandling exception inside library itself

Add any other context about the problem here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant