Closes #916. I think the issue is that the datasets resource needs to be cleared/reset after the form draft is published. That's because publishing a draft can have the effect of publishing a new entity list. In FormDraftStatus, the afterPublish() method re-requests, resets, or updates many resources, but it doesn't do so for datasets. That means that if FormAttachmentList requested datasets before the draft was published, it won't do so again after the draft is published (unless the page is refreshed or the user navigates away from the form).
What has been done to verify that this works as intended?
I wrote two new tests about this scenario (under "linking after publishing new dataset"). The first test involves publishing the project's first entity list, and it passed without any changes. The second test involves publishing a second entity list for the project, and it only passed after I updated afterPublish().
Why is this the best possible solution? Were any other approaches considered?
While looking at this issue, it didn't always feel clear when or where resources were re-requested, reset, or updated. There's probably room for improvement there (though I don't have any specific ideas at the moment). However, given that afterPublish() is already modifying a lot of resources, I think it makes sense that it should also reset datasets.
Before submitting this PR, please make sure you have:
[x] run npm run test and npm run lint and confirmed all checks still pass OR confirm CircleCI build passes
[x] verified that any code or assets from external sources are properly credited in comments or that everything is internally sourced
Closes #916. I think the issue is that the
datasets
resource needs to be cleared/reset after the form draft is published. That's because publishing a draft can have the effect of publishing a new entity list. InFormDraftStatus
, theafterPublish()
method re-requests, resets, or updates many resources, but it doesn't do so fordatasets
. That means that ifFormAttachmentList
requesteddatasets
before the draft was published, it won't do so again after the draft is published (unless the page is refreshed or the user navigates away from the form).What has been done to verify that this works as intended?
I wrote two new tests about this scenario (under "linking after publishing new dataset"). The first test involves publishing the project's first entity list, and it passed without any changes. The second test involves publishing a second entity list for the project, and it only passed after I updated
afterPublish()
.Why is this the best possible solution? Were any other approaches considered?
While looking at this issue, it didn't always feel clear when or where resources were re-requested, reset, or updated. There's probably room for improvement there (though I don't have any specific ideas at the moment). However, given that
afterPublish()
is already modifying a lot of resources, I think it makes sense that it should also resetdatasets
.Before submitting this PR, please make sure you have:
npm run test
andnpm run lint
and confirmed all checks still pass OR confirm CircleCI build passes