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
refactor(FormEditor): use .getRelationship() in viewSpec #4763
base: production
Are you sure you want to change the base?
Conversation
specifyweb/frontend/js_src/lib/components/FormEditor/viewSpec.ts
Outdated
Show resolved
Hide resolved
const cellRelatedTableName = cellRelationship?.relatedTable.name; | ||
const cellRelationship = | ||
typeof cellName === 'string' | ||
? syncers.field(table?.name).serializer(cellName)?.at(-1) |
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.
by using syncers.field, an error will be thrown on invalid field name
@@ -658,7 +659,7 @@ export const syncers = { | |||
]) as TYPE_MAPPER[keyof TYPE_MAPPER]) ?? ('Unknown' as const); | |||
const spec = mapper[type] ?? mapper.Unknown; | |||
const { serializer } = syncers.object( | |||
spec(cell, { ...extraPayload, rawType }) | |||
spec(cell, extraPayload, rawType) |
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.
this was causing extraPayload
object to loose it's prototype chain, thus table was loosing the getRelationship
and all other methods
Refactor code in response to code changes in PR #4748 (it was merged before I had a chance to fix it)
Checklist
and self-explanatory (or properly documented)
Testing instructions