List or Library Control shows data when Form is not completed but data in related list already entered

Hello,
i have the following issue:

I have a form where i do have a list control placed with lookup to show only related data. it works fine if the user adds related data and clicks save.

The issue i have is iwhen the user opens the form -> adds some data in the related list and then clicks "Close" and not "Save" because he wants to cancle. The related item is already created and next time he opens a new Form the realted item is already there and displayed.

How can i make sure that the List Control does not display the items which have been made by mistake. it seems like when the lookup field is "empty" that this values are displayed by default in the new form.

I already use
fd.clear(); within fd.spRendered but this does not have any effect on libraries as it looks like.

Is there any way i can set back the whole new form including list/libraries when creating a new one?

Dear @andreas,
The issue here is that the items in List or Library are created and saved to another list, so they exist on their own - regardless of the status of the parent item. There are ways to do deal with it, though neither one is perfect:

  1. Move List or Library to Edit form, and simply redirect users on save from New Form - this way they'll only create items for an existing parent.
  2. Use Workflow or Power Automate flow to periodically clear parent-less items. It won't help in all the cases, but at least the items won't pile up.
  3. Use JavaScript to delete parent-less items when New form is opened. Would always work, but dangerous as it might delete items another user is creating at the same time.

Dear @Nikita_Kurguzov
Thanks for your reply - i see.

I think in our use case 3 would work with the limitation to only delete parent-less items which have been created by the user which is currently creating a new form. There won't be many users creating new parent items in parallel.

Would you have an example for me in JavaScript to delete parent-less items created by [Me] -> i guess it needs to extecuted when the new form loads.

Thank you in advance
Andreas

Dear @andreas,
It would be something like this:

pnp.sp.web.lists.getByTitle('Child List').items.filter("Author/EMail eq '${encodeURIComponent(_spPageContextInfo.userEmail)}' and Parent/Id eq null").delete();