itwinjs-core icon indicating copy to clipboard operation
itwinjs-core copied to clipboard

API to allow an Element to be moved across models

Open RohitPtnkr1996 opened this issue 1 month ago • 5 comments

imodel-native: https://github.com/iTwin/imodel-native/pull/1300

Fixes: https://github.com/iTwin/itwinjs-backlog/issues/1481

RohitPtnkr1996 avatar Dec 05 '25 13:12 RohitPtnkr1996

I'd like to understand the use case for this. Who is asking and why? Moving an element between models is disallowed for good reasons. It also doesn't seem right to have this magically apply to assemblies.

kabentley avatar Dec 05 '25 14:12 kabentley

I'd like to understand the use case for this. Who is asking and why? Moving an element between models is disallowed for good reasons. It also doesn't seem right to have this magically apply to assemblies.

Diego has mentioned it on the work item for this PR https://github.com/iTwin/itwinjs-backlog/issues/1481.

RohitPtnkr1996 avatar Dec 05 '25 14:12 RohitPtnkr1996

Diego has mentioned it on the work item for this PR https://github.com/iTwin/itwinjs-backlog/issues/1481.

I don't have access to the issues. Can you please explain it? Which Diego?

kabentley avatar Dec 07 '25 17:12 kabentley

Diego has mentioned it on the work item for this PR iTwin/itwinjs-backlog#1481.

I don't have access to the issues. Can you please explain it? Which Diego?

Right sorry, I should've been more specific. @diegoalexdiaz has mentioned on the work item that this change is for domain-specific authoring apps which know how to handle data in their own channels safely.

RohitPtnkr1996 avatar Dec 08 '25 06:12 RohitPtnkr1996

I spoke to @diegoalexdiaz about this. Please talk to him about how to proceed.

kabentley avatar Dec 08 '25 19:12 kabentley

As per the recent discussion on the BWG call, the API needs be a bulk move which changes the model of the child elements as well to avoid relaxing the parent-child must be in the same model rule. Also, an idea of exploring this as a possible use case for the requested re-design of the editing api was floated. This is to ensure the change is atomic and can be rolled back on any failures that occur midway. However, this PR contains the alternate approach which checks if any unsaved changes exist beforehand to then allow a rollback if the API throws an error. This PR contains extensive tests as well which are covering all the requirements mentioned. However, since there are still discussions to be had, and the requirements might change, I am closing this PR for now. Will reopen and update once the requirements and approach are concrete.

RohitPtnkr1996 avatar Dec 17 '25 07:12 RohitPtnkr1996