-
Notifications
You must be signed in to change notification settings - Fork 21
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
fix(feed): Parse MusicAudio and Video posts metadata on Map Feed #1400
Open
sujal-into
wants to merge
8
commits into
main
Choose a base branch
from
bugfix/video-audio-map
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
f2115fb
fix: made keys for social post optional while parsing except title
sujal-into 3a16113
fix: added a function to parse different social feed categories metadata
sujal-into ece2bac
fix: used switch case to parse different social feed metadata
sujal-into 7a18deb
fix: Changed to feedArticle metadata for article type
sujal-into ac6d3b5
default social media parse to common metadata
sujal-into 8a0ebc6
fix: feed post metadata check for video and article
sujal-into 0b9046c
fix: removed post metdata option from video and article type
sujal-into 1ac1350
Merge branch 'main' into bugfix/video-audio-map
WaDadidou File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
You don't need to modify the Zod type to try parse.
Yes,
ZodSocialFeedPostMetadata
shape can be wrong, but we have made other shapes for other posts categories. So we need to handle them.Reformulation: The issue is due to the fact we have 4 differents types for the fetched posts.
Here we only try to parse
ZodSocialFeedPostMetadata
. So, the tracks and videos posts validation fails.The
result
here has nosuccess
: https://github.com/TERITORI/teritori-dapp/blob/bugfix/video-audio-map/packages/utils/sanitize.ts#L22If you
console.log
theresult
, you will see what's wrong to validateZodSocialFeedPostMetadata
To avoid that, because the map gathers all posts categories, we must handle these Zod types. Here is my suggestion:
We need a refacto about it. Either unify all types in one, either add an utilitary function to handle (try parse) these differents zod types
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.
actually no there is the
zodSocialFeedCommonMetadata
schema when you need to only parse the titleThere 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 have made a fix for this discussion in this commit: 3a16113
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.
In this case, there are other things that i need to parse also based on the category type, so I have created a util function to handle those cases.
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.
you can switch on the post type to do the proper parsing in each case, the whole point of using zod is to have type safety, using a
z.ZodTypeAny
entirely defeat this purposeThere 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 have used switch and removed the ZodTypeAny : ece2bac