Sage-Bionetworks / sage-monorepo

Where OpenChallenges, Schematic, and other Sage open source apps are built
https://sage-bionetworks.github.io/sage-monorepo/
Apache License 2.0
21 stars 12 forks source link

fix(openchallenges): create pipe to map enum values of challenge properties to labels #2612

Closed rrchai closed 3 months ago

rrchai commented 3 months ago

Changelog

rrchai commented 3 months ago

I realize the challenge card has incentive information. To avoid calling the function hundreds of times to get incentive label for each challenge card, I will change to create a separate mapping file for label-value.

rrchai commented 3 months ago

When I was trying to update the incentive in the challenge card component, all pages displayed blank with an error indicating that loading the footer failed. Here is the error message.

statistics-viewer.component.ts:13 Uncaught TypeError: Cannot read properties of undefined (reading 'FooterComponent')
    at Module.FooterComponent (statistics-viewer.component.ts:13:72)
    at 72716 (challenge-search.component.ts:83:5)
    at __webpack_require__ (bootstrap:19:1)
    at 17844 (challenge-search.component.ts:87:34)
    at __webpack_require__ (bootstrap:19:1)
    at 15392 (variables.ts:9:2)
    at __webpack_require__ (bootstrap:19:1)
    at 71604 (mock-avatars.ts:14:2)
    at __webpack_require__ (bootstrap:19:1)
    at 65488 (statistics-viewer.component.ts:13:72)

I noticed this issue when I shared the mapping file in the challenge-search library via index.ts. However, the error disappears if I share it in the ui library. I'm not sure if it's related to a recurring module loading issue.

rrchai commented 3 months ago

I noticed this issue when I shared the mapping file in the challenge-search library via index.ts. However, the error disappears if I share it in the ui library. I'm not sure if it's related to a recurring module loading issue.

Potential circular dependency, if creating a new mapping file stored in challenge-search/challenge:

The new mapping file cannot be in the challenge/challenge-search lib to avoid the error.

Potential circular dependency, If using a function to retrieve the labels from an existing mapping file in challenge-search:

This approach is not doable, as the reusable function needs to be isolated from challenge-search to avoid the error, unless creating/moving a mapping file. Or directly import the mapping file from challenge-search, see this comment.


I am creating a pipe directly importing the existing mapping file from challenge-search.

sonarcloud[bot] commented 3 months ago

Quality Gate Passed Quality Gate passed for 'openchallenges-app'

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud