KayelGee / token-attacher

MIT License
12 stars 18 forks source link

ISSUE: Element already in chain of attachments. See console for more details. #93

Closed krobibero closed 3 months ago

krobibero commented 1 year ago

Issue with the latest version of Token Attacher. Tested in both a Pathfinder and Starfinder worlds with the same results.

I receiving the following when trying to attach a token, to another token. These tokens are not attached to anything else.

Element already in chain of attachments. See console for more details. foundry.js:59187

I've removed/reinstalled Token Attacher a few times which has not cured the issue. I witnessed the folder for TokenAttacher be deleted and recreated to ensure it's actually being removed.
Today I tried Find the Culprit!, which removed all modules accept Token Attacher and Lib-Wrapper. The issue remains..

The console does not show any other details, just the message above.

I'm at a loss.

krobibero commented 1 year ago

Here is more details. This is coming from within the console.

foundry.js:22349

   Uncaught (in promise) TypeError: undefined. Cannot read properties of null (reading '_preUpdate')

[No packages detected] at SFRPGTokenDocument._preUpdateTokenActor (foundry.js:22349:24) at SFRPGTokenDocument._preUpdate (foundry.js:22262:18) at async ClientDatabaseBackend._preUpdateDocumentArray (foundry.js:12734:7) at async ClientDatabaseBackend._updateEmbeddedDocuments (foundry.js:12661:22) _preUpdateTokenActor @ foundry.js:22349 _preUpdate @ foundry.js:22262

KayelGee commented 1 year ago

Sorry for not responding earlier. I'm not exactly understanding what you're doing to cause the issue. Are you using the manual attach method: https://github.com/KayelGee/token-attacher#attach-or-detach-element Or are you using the multi layer select tool: https://github.com/KayelGee/token-attacher#attach-with-multi-layer-selection-tool If you're using the first variant then you are not allowed to select both tokens when you click the attach button. You have to select the token you want to attach to the base token only and then click the attach button. I recommend using the multi layer selection tool, as it's usually more straightforward.

krobibero commented 1 year ago

I was tested some more first by using the Find the Culprit module. Using it, I disabled all the modules except Token Attacher and lib-wrapper. After going through that process, it found that no other module seemed to be causing the issue.

Then I tried to recreate the issue to give you better perspective.

Testing Steps:

  1. Drop a token into a scene that does not have anything attached.
  2. Click the token, then click the Open Attaching UI button. (Token Attacher UI appears)
  3. Click the Attach Selected Elements button That is when the message "Element already in chain of attachments. See console for more details." pops-up.

In the console there is also Uncaught (in promise) TypeError: undefined. Cannot read properties of null (reading '_preUpdate') [No packages detected] at SFRPGTokenDocument._preUpdateTokenActor (foundry.js:22349:24) at SFRPGTokenDocument._preUpdate (foundry.js:22262:18) at async ClientDatabaseBackend._preUpdateDocumentArray (foundry.js:12734:7) at async ClientDatabaseBackend._updateEmbeddedDocuments (foundry.js:12661:22)

Does this help?

KayelGee commented 1 year ago

yeah you're trying to attach the token to itself. You have to select the things you want to attach to the token and then click the attach button. See the gifs I linked before.

krobibero commented 1 year ago

I must be going crazy... Yeah, that is probably it.