# Bug OP-8158 - All data lost when switching from details view to fullscreen view while creating a work package

Project: OpenProject
Status: closed
URL: https://community.openproject.org/work_packages/OP-8158

## Open points

_No work packages_

## Details

| Attribute | Value |
| --- | --- |
| Date |  |
| Priority | High |
| Module |  |
| Target versions | 11.2.1 |
| Observed in versions |  |
| Sprint |  |
| Backlog bucket |  |
| Bug found in version (deprecated) |  |
| Found in mobile app version |  |
| Follow-up feedback e-mail |  |
| Requires doc change | No |
| Accessibility | No |
| Pull preview |  |
| List |  |
| Labels |  |

## People

| Attribute | Value |
| --- | --- |
| Assignee |  |
| Accountable |  |
| Product manager |  |
| Developers |  |
| Designer |  |
| Ordered by |  |
| Signed off by |  |
| Interest by |  |

## Planning

| Attribute | Value |
| --- | --- |
| Relevance |  |

## Costs

| Attribute | Value |
| --- | --- |
| Votes |  |
| Work |  |
| Labor costs |  |

## Description

### **Environment**:

Your OpenProject Version: Cloud Edition

Operating System / Browser / OpenProject language: n/a

### **Logs**

### **Steps to reproduce:**

1\. Go to <https://community.openproject.com/projects/openproject/work_packages/create_new?type=6> (you should be in details view now)  
2\. Change the workpackage type to Epic  
3\. Add some text in the description  
4\. Change to fullscreen view

Actual behavior: The fullscreen view is opened, the template of the Epic is kept, the type changes back to Feature and the information I added is lost.

OR:  
1\. Go to workpackages list, click on +Create and choose Task (details view should be opened)  
2\. Add "abc"  
3\. Change type to Idea  
4\. Add "def"  
5\. Change to fullscreen view

Actual behavior: The fullscreen view is opened, the type changes back to Task, "abc" is kept and "def" is lost.

I guess this is connected to the fact that the URL does not change when I change the workpackage type.

### **Actual Behavior**

see <https://community.openproject.com/projects/openproject/work_packages/35968/activity#activity-5>

### **Expected Behavior**

I keep the entered data and can continue working. Or there's at least a warning that I'm about to loose my data asking me if I want to continue (like one of these already in use in other cases:)

<figure class="image op-uc-figure" style="width:50%;"><div class="op-uc-figure--content"><img class="op-uc-image" src="/api/v3/attachments/20311/content"></div></figure>

<figure class="image op-uc-figure" style="width:50%;"><div class="op-uc-figure--content"><img class="op-uc-image" src="/api/v3/attachments/20312/content"></div></figure>

### Development Notes

  - Issue explanation:
      - The wp type select doesn't update the route params (wp type) when it changes.
      - When the user clicks on the 'maximize' form icon, the user is redirected to "/\[project\_id\]/work\_packages/new?type=\[wp\_type\]" and it keep the params from the original route ("/\[project\_id\]/work\_packages/create\_new?type=\[wp\_type\]") that are not updated.
      - There, the WorkPackageCreateService.continueExistingEdit returns false because the wp type param is not equal to the wp type from the changeset.
  - Alternatives:
      - Register a HalResourceEditFieldHandler.\_onSubmitHandlers that would update the params when the wp type is changes.
          - Impediment: \_onSubmitHandlers are not called if the this.form.editMode is true (which is the case because it is a new form).
