-
Couldn't load subscription status.
- Fork 14
Bugfix: Custom icon missing from search suggestion results for RFPs #474
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
base: main
Are you sure you want to change the base?
Conversation
…ased on document_type
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| */ | ||
| export function getContentTypeFromDocumentType( | ||
| documentType: string | ||
| ): 'paper' | 'post' | 'funding_request' | 'preregistration' { |
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.
We need to do cleanup because funding_request and preregistration mean the same thing.
I feel like Nick created this function already in one of his PRs. @nicktytarenko - can you confirm?
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.
-
if i am not mistaken
funding_requestis the same thing asgrantin the web app world.. you can see the evidence in this historical mocked data: https://github.com/ResearchHub/web/blob/main/store/grantStore.ts#L27
there was naming changes to this entity. so, it's probably still confused in the web app 🤯 -
actually we do not have a function to convert API contentType to the App type, we do it on a fly when we transform the work details response in the types/work.ts.
-
if you pull the latest
maininto this branch you will see the method for convertingWebApptypeToAPIType. it's like the opposite of this
cc @yattias
| BOUNTY: 'post', | ||
| HYPOTHESIS: 'post', | ||
| }; | ||
| return contentTypeMap[documentType] || 'post'; |
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'd rather we not use post as default. We can return null as well if no appropriate match is found
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.
hm.. if we switch it to null that might potentially break few things and would require a bigger refactor of the codebase to incorporate the new approach which is why it was defaulting to post in the first place.
Pros:
- We could identify when unknown document types appear
Cons:
- Requires defensive coding: Every caller would need to handle null explicitly
- Risk of broken links: Without proper null handling, URLs could break or redirect incorrectly
My recommendation is to keep the post as default and add a warning log. Your call but refactoring would prolly require its own PR and potentially be changing many files.
|



Issue: ResearchHub/issues#599
Before
After