League-of-Foundry-Developers/foundryvtt-forien-quest-log

[BUG] Changing quest state will remove all pending changes in quest description

Closed this issue · 5 comments

rlach commented

Module Version: v0.7.9

Describe the bug
If you write anything in quest description the press any of the buttons to change it's state, for example from "Available" to "In Progress" then all changes will be lost with no warning. This is unexpected since there's no way to manually save the text before - the only way to save the text currently seems to be closing the quest window.

To Reproduce
Steps to reproduce the behavior:

  1. Go to existing quest.
  2. Type something in description field.
  3. Click one of "Set as" buttons
  4. The description is reset to whatever it was before you started editing.

Expected behavior
All pending changes are saved, then the status is changed.

Screenshots

Browser:

Foundry Version:
v9, build 266

Game System:
pf2e 3.8.3

Additional context

Hi @rlach. Yeah I thought perhaps this was worked out in the past. It is due to the standard Foundry core application lifecycle as things go. This won't be an issue in the new quest log continuation module. I won't get this fixed in FQL.

I gather that if you make a description / TinyMCE edit and then close the quest before finishing editing that it saves the modified description content even though it wasn't explicitly saved? It was designed to do that and likely that design also caught the issue you are raising now, but possibly not. So let me know if that isn't working either.

Hi @rlach.. I did at least verify this issue and can mention it is indeed a legitimate bug. You had me worried that automatic saving wasn't working in general for some reason. Indeed it is only when you select the different status icons on the quest details UI when you have open edits to the description. As things go it is a one line fix simply to save the quest before changing the status when on the quest details page. :O Good catch!

I think I'll still just postpone fixing / making sure this works for the new quest log module.

rlach commented

Yes, it's exactly as you say. Now that I know not to press those buttons I do it with close first approach. I'll be watching out for the new module then ;)

Yeah.. The quest log / FQL with the stock / core Foundry Application API is real tough to manage complex applications. FQL may look reactive, but it is a lot of manual tracking / managing state and making sure to save it before a re-render occurs which is how any of the data / display updates; it requires a full re-render of everything. This makes FQL hard to test and even though I spent hundreds of hours developing / testing I never once tried having an active edit of the description then hitting the switch status button. :O No worries though as this is a super edge case IMHO. No one else noticed it before you did, so gold star for you.. ;P

The new quest log will be fully reactive where updating any one part of the data / GUI doesn't require a full re-render of the entire UI. This makes things so much easier for complex applications.

This is fixed in the upcoming v10 compatibility release for FQL. Thanks again @rlach!