githubbob42 / mingle2github2

0 stars 1 forks source link

Ticket reporting dies after deleting ticket item #3344

Open githubbob42 opened 9 years ago

githubbob42 commented 9 years ago

Mingle Card: 3656 Analysis

I appears that when we enter the Reports tab, the child-relationship module is loading up the children and setting the parent reference onto each child.  Then when the ticket item is removed (Ticket.prototype.handleTicketItemRemovedFromTicket in ticket/index.js - line 203) it’s doing the scorched earth disposal which is in turn disposing (hollowing out) of the newly added parent Ticket object.

The problem here is two fold:

  1. During the setup of the PrintDataContext, we load up the TIckets children (i.e. ticket items, etc) and set those on the Ticket object.
  2. We also set a reference to the Ticket on each of the ticket items.

So when we remove a ticket item, during the disposal process, we hollow out the Ticket object.  This causes problems because the Ticket object is still being used by other contexts (i.e. we’re still in the details of the Ticket).

We are also hollowing out the ticket item object yet we still have a reference to it in the Ticket objects FX5__Ticket_Items__r collection that has not been removed.  This is what causes the Report tab to break after going back to the reports tab after deleting an item.

I toyed with some ideas about how to avoid hollowing out the Ticket object off of the ticket item(s) and determined that the correct approach is to have the PrintDataContext and ChildRelationship object properly clean up after themselves.  This will involve:

Doing the above should correctly/appropriately allow the removal of any report-only objects, added solely for the purpose of reporting, when the report modal is deactivated.

UPDATE:

There are a number of factors going here.  

| | |
|-|-|
|

### Ticket Item Grid

   |
|  

   with Dispose|
|

w/o Dispose

   |
|Initial Load/Refresh|24.4 MB|
|24.4 MB|
|Add item|29.2 MB|
|29.2 MB|
|Refresh|26.5 MB|
|26.5 MB|
|Delete item|25.1 MB|
|25.1 mB|
|Refresh|24.3 MB|
|24.3 MB|

Steps to reproduce

| | |
|-|-|
|**Version #**|
| |
|**OS**|
| |
|**Browser**|
| |
|**Username**|
| |
|**Password**|
| |
  1. login to mobile
  2. go to a ticket
  3. go to the Reports tab,
  4. click plus (+) to create a report
  5. close it
  6. go to the items tab
  7. delete an item
  8. go back to reports tab,
  9. click plus (+) to create a report
  10. spinner just spins

Alternate path: replace steps 8, 9, 10 with

  1. go to Tickets list on Job

Expected result

What should happen?

Actual Result

What actually happens?

Related Cards

Test Plan

goto a ticket

add an item

goto reports tab, open report (no need to save – just close it)

go back to items delete item.

(two paths to test from here)

  1. go back to reports tab and open report
  2. to the Tickets list on Job

Checklist for Merging

githubbob42 commented 9 years ago

Pull Request #1596