Lavaeolous / PF1-StatBlock-Converter-Module

FoundryVTT Module to convert PF1 Statblocks into Foundry Actors (PC or NPC).
MIT License
14 stars 12 forks source link

Changes to the reinitialization reintroduced some old buggy behaviour #513

Closed Lavaeolous closed 2 years ago

Lavaeolous commented 2 years ago

Changing statblocks in the input field leads to a new parsing of the data (which is good), but some data is retained between throughout the parsing (which is bad and leads to multiples of items/features/spells in the actor).

Lavaeolous commented 2 years ago

Hm, i'm not sure if thats related to the changes in reinitialization or the general refactor and the changes maybe to toObject(false), i'll have to take a look later.

@mkahvi If you have the time you could check this as well but it's not urgent. The merges are in the master branch, but not yet in a release, so you would need to check them out manually.

mkahvi commented 2 years ago

It's likely the re-initialization changes. I probably missed a spot where it needs to reset fully.

Update: I can't reproduce this on quick testing.
Only time I can think of something like that happening is if new statblock is pasted (or current one modified) without reset, but that should be unrelated to my PRs.

mkahvi commented 2 years ago

Simple hard fix is probably adding sbcData.resetData(); to updatePreview() or near that workflow. This is a bad fix, but the idea behind it was the right one.

Lavaeolous commented 2 years ago

Sorry, i missed info about how to replicate this:

  1. Input a statblock
  2. Change any value in the input field to trigger a re-parsing
  3. Import the Actor
  4. The Actor now has duplicates of some items/features/etc.

I'll test, if the PR fixes that.

mkahvi commented 2 years ago

I'm not seeing any duplication with the PR in use at least, with those steps.