Skip to content
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

Open
wants to merge 3 commits into
base: production
Choose a base branch
from

Conversation

maxpatiiuk
Copy link
Member

@maxpatiiuk maxpatiiuk commented Apr 9, 2024

Refactor code in response to code changes in PR #4748 (it was merged before I had a chance to fix it)

Checklist

  • Self-review the PR after opening it to make sure the changes look good
    and self-explanatory (or properly documented)

Testing instructions

@maxpatiiuk maxpatiiuk self-assigned this Apr 9, 2024
@maxpatiiuk maxpatiiuk requested review from a team and CarolineDenis April 13, 2024 14:56
const cellRelatedTableName = cellRelationship?.relatedTable.name;
const cellRelationship =
typeof cellName === 'string'
? syncers.field(table?.name).serializer(cellName)?.at(-1)
Copy link
Member Author

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)
Copy link
Member Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 📋Back Log
Development

Successfully merging this pull request may close these issues.

None yet

2 participants