#316: Add helper func to get activity titles from ids in Opp-List#384
#316: Add helper func to get activity titles from ids in Opp-List#384
Conversation
| @@ -16,4 +16,5 @@ export const defaultOpportunityCardsFilter: OpportunityCardsFilter = { | |||
| [OpportunityType.EVENTS]: false, | |||
| [OpportunityType.REGULAR]: false, | |||
| }, | |||
There was a problem hiding this comment.
ACTIVITY is not part of QueryParamsKeys hence why I went for EntityTableName. But I can update the sdk if needed
There was a problem hiding this comment.
Review
Issue 1 — Activity filters won't restore from URL
In src/components/Dashboard/Opportunities/Filters/helpers.ts, the deserialization loop:
```ts
queryActivities.forEach((l) => {
if (newFilter.activity[l] !== undefined) newFilter.activity[l] = true;
});
```
defaultOpportunityCardsFilter initializes activity as {}, so every key is undefined — the condition is always false and activity filters are never restored from the URL when navigating back.
Fix:
```ts
queryActivities.forEach((l) => {
newFilter.activity[l] = true;
});
```
Issue 2 — Type consistency in getActivityTitles
In src/components/Dashboard/Opportunities/helpers.ts:
```ts
const activityMap = new Map(activityList.map((item) => [item.id, item.title])); // key: number
return activities.map((act) => activityMap.get(Number(act.id))) // lookup: Number(string)?
```
act.idanditem.idare the same type at runtime.? Ifact.idis a string, the map lookup will always miss (different types as Map keys). Safest fix is to key everything withString(id)` consistentl
|
thanks for the review @nadavosa ! I've committed those changes now |
|
FYI I've noticed we're not actually importing/using the |
Yes this is important, we alwasy need to refilter because oft that - can you open an issue? |
|
sure thing |
Description
Adds helper func to get activity titles from ids in the options array. This was neccessary to display activities in the opportunity cards
Adds Activity filter
Related Issues
Closes #316
Changes
Screenshots / Demos
Checklist