Skip to content
This repository has been archived by the owner on Nov 29, 2023. It is now read-only.

Fix: restore population of deprecatedID in edit mode #345

Merged
merged 1 commit into from
Oct 21, 2021

Conversation

eyelidlessness
Copy link
Contributor

This was a regression in #321: record here is populated by _checkAutoSavedRecord, which is only available in offline mode. Since that will always be falsey (undefined) in edit mode, submitted would be set to false. Since we should only set deprecatedID when editing submissions, it made more sense to assign it directly based on the isEditing property introduced in #269 (which should also have been added to the JSDoc type at that time).

This was a regression in enketo#321. `record` here is populated by `_checkAutoSavedRecord`, which is only available in offline mode. Since that will always be falsey (undefined) in edit mode, `submitted` would be set to false. Since we should only set `deprecatedID` when editing submissions, it made more sense to assign it directly based on the `isEditing` property introduced in enketo#269 (which should also have been added to the JSDoc type at that time).
// Make sure that Enketo Core won't do the instanceID --> deprecatedID move
data.submitted = false;
}
data.submitted = Boolean( data.isEditing );
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An added benefit of this approach, in my opinion, is that submitted is now always explicitly set, so we don't need to rely on the implicit behavior in enketo-core when it's not set (which unexpectedly defaults to true).

@yanokwa
Copy link
Member

yanokwa commented Oct 21, 2021

As far as process, once this is reviewed, it will be merged to master then we will cherry pick and put it on a long-lived 3.0.x branch and tag it.

@lognaturel
Copy link
Contributor

lognaturel commented Oct 21, 2021

Like you say, it seems this captures the intent much more clearly. It feels very safe but then again, so did #321. 😭

sources of risk I can think of:

  • there’s some condition we’re not thinking of under which isEditing is false but a deprecatedId should be generated.
  • there’s some condition we’re not thinking of under which isEditing is true but a deprecatedId should not be generated.

I’ve reviewed the types of URLs carefully and those risks really do feel low. But my confidence is shaken.

We need to do a point release. We can either do it with this and it will get some QA exercise but not a full regression pass or revert #321 for the point release and then do a more thorough QA pass with this. I’ve gone back and forth but seeing this PR, I’m inclined to merge it for the point release.

@lognaturel
Copy link
Contributor

lognaturel commented Oct 21, 2021

@yanokwa I believe the release can be tagged on master.

@yanokwa
Copy link
Member

yanokwa commented Oct 21, 2021

@lognaturel We've merged #340 to master and it hasn't gone through QA.

@lognaturel
Copy link
Contributor

Sigh, ok, sorry.

Copy link
Contributor

@lognaturel lognaturel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving with the caveats on confidence in my comment above. It feels like the better choice over a simple revert.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants