-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tweak(adminPanel): RN-1419: Don't delete survey screens and components on import unless they have changed #5885
base: dev
Are you sure you want to change the base?
Conversation
@@ -23,10 +23,16 @@ import { | |||
SURVEY_METADATA, | |||
} from './processSurveyMetadata'; | |||
import { caseAndSpaceInsensitiveEquals, convertCellToJson } from './utilities'; | |||
import { RECORDS } from '@tupaia/database'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import { RECORDS } from '@tupaia/database'; |
const objectsAreEqual = (a, b) => { | ||
if (!!a === !!b) return true; | ||
return JSON.stringify(a) === JSON.stringify(b); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this function is always going to be correct. I would probably just outsource this to lodash isEqual here since we need to do a deep equality check?! Or if you update the function it would probably be good to add a unit test for it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything it looking good apart from the object equality check
Issue RN-1419: Don't delete survey screens and components on import unless they have changed
Changes:
importSurveyQuestions
to only update relevant fields in the survey screen component