design-first / system-designer

A low-code development platform for creating systems πŸ‡ΊπŸ‡¦#standwithUkraine
https://designfirst.io/systemdesigner/
Apache License 2.0
930 stars 136 forks source link

Renaming a method results in loss of code #143

Open therckenrath opened 2 years ago

therckenrath commented 2 years ago

Describe the bug When you rename a method in Schema the definition in Model is completely replaced and implementation of the method disappears completely. When the method is renamed back to its original name, the definition in Model is again completely erased and the implementation of that method is reset to the default template - the original code is gone.

To Reproduce Steps to reproduce the behavior:

  1. Create a Schema with a method and implement the code in the method.
  2. Rename the method in the Schema
  3. Click on the method name in Model - no method is displayed
  4. Rename the method back to its original name
  5. Click on the method name in Model - the default method template is displayed

Expected behavior I expect the name of the method to be updated in Model and in the implementation of the method and I expect the code of the implementation to remain untouched.

Desktop (please complete the following information):

ecarriou commented 2 years ago

Thanks for reporting the issue !

In fact it is a normal behavior: when renaming a method from a schema and saving, here what we do:

  1. we compare the new schema with the old one,
  2. we notice that the method name is not more there, so we remove it from the model and remove its behavior (if any)
  3. we also notice that a new method name is there, so we add it to the model

So to be able to keep the behavior, we need to be sure that we were in the case of a renaming and not of a deleting / adding. Need to check how to do that.

therckenrath commented 2 years ago

Hi Erwan,

I understand the issue you're facing.

May I suggest a diff type popup to give the user the chance of specifying what to do?

In the meantime, perhaps you could mention this behaviour in the readme?

Tjerk

On Wed., Jan. 5, 2022, 9:17 a.m. Erwan Carriou, @.***> wrote:

Thanks for reporting the issue !

In fact it is a normal behavior: when renaming a method from a schema and saving, here what we do:

  1. we compare the new schema with the old one,
  2. we notice that the method name is not more there, so we remove it from the model and remove its behavior (if any)
  3. we also notice that a new method name is there, so we add it to the model

So to be able to keep the behavior, we need to be sure that we were in the case of a renaming and not of a deleting / adding. Need to check how to do that.

β€” Reply to this email directly, view it on GitHub https://github.com/design-first/system-designer/issues/143#issuecomment-1005723181, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALMMFGZC6DLU6RV3GICXYNTUURHIBANCNFSM5LI3WALQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you authored the thread.Message ID: @.***>

ecarriou commented 2 years ago

The documentation has been updated to inform users about this behavior (see https://designfirst.io/systemdesigner/documentation/docs/en/create-a-schema.html#define-a-method) .

therckenrath commented 2 years ago

Awesome πŸ˜€

On Fri., Jan. 7, 2022, 5:48 p.m. Erwan Carriou, @.***> wrote:

The documentation has been updated to inform users about this behavior (see https://designfirst.io/systemdesigner/documentation/docs/en/create-a-schema.html#define-a-method) .

β€” Reply to this email directly, view it on GitHub https://github.com/design-first/system-designer/issues/143#issuecomment-1007799483, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALMMFG3QO6J43GAV34A2ZZ3UU5UU7ANCNFSM5LI3WALQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you authored the thread.Message ID: @.***>