How to determine if an Object was created in a write transaction?

When attempting to call freeze() I’m receiving this error:

“Cannot freeze an object in the same write transaction as it was created in.”

The error makes sense, but it’s not clear how to avoid it. I’d prefer to do so by inspecting the object to determine if calling freeze() will be allowed, as opposed to needing to keep a list of any objects created in the transaction.

Any suggestions welcome! Thanks!

Hi @Tom_J !

I am pretty sure I know why and how to avoid it but want to ensure the question is clear; and that’s best done through some code. I think we need to see a brief minimal code example. Can you edit your question and include that please?

Jay