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

Austenem/CAT-1113 Add list metrics #3689

Merged

Conversation

austenem
Copy link
Collaborator

Summary

Adds metrics for the "My Lists" feature.

Design Documentation/Original Tickets

CAT-1113 Jira ticket

Testing

Tested using Matomo and event logging.

Checklist

  • Code follows the project's coding standards
    • Lint checks pass locally
    • New CHANGELOG-your-feature-name-here.md is present in the root directory, describing the change(s) in full sentences.
  • Unit tests covering the new feature have been added
  • All existing tests pass
  • Any relevant documentation in JIRA/Confluence has been updated to reflect the new feature
  • Any new functionalities have appropriate analytics functionalities added

Copy link
Collaborator

@NickAkhmetov NickAkhmetov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the standardization, but have some mild concerns about how the new hook is defined.

Comment on lines 355 to 376
function useHandleSaveEntity({ entityUUID }: { entityUUID: string }) {
const {
entity: { entity_type },
} = useFlaskDataContext();
const [entityData] = useEntitiesData([entityUUID], ['hubmap_id']);

return useCallback(() => {
handleSaveEntities({ entityUUIDs: new Set([entityUUID]) }).catch((error) => {
console.error(error);
});

if (!entityData?.length) {
return;
}

trackEvent({
category: SavedListsEventCategories.EntityDetailPage(entity_type),
action: 'Save Entity to Items',
label: entityData[0].hubmap_id,
});
}, [entityUUID, entityData, entity_type]);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be defined outside of the useListSavedListsAndEntities hook, i.e. as its own hook? Since running this function instantiates new hook calls, calling this function at runtime could cause errors related to varying numbers of hooks per render.

Copy link
Collaborator

@NickAkhmetov NickAkhmetov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@austenem austenem merged commit 8de28a8 into austenem/cat-754-refactor-my-lists Feb 12, 2025
5 checks passed
@austenem austenem deleted the austenem/cat-1113-add-list-metrics branch February 12, 2025 20:29
austenem added a commit that referenced this pull request Feb 13, 2025
* add ukv endpoint

* pull authenticated lists into my lists page

* implement add functionality

* refactor hooks

* update deletion functionality

* update lists functionality

* fix typing

* add entity to list functionality

* edit and deletion functionality

* liststobedeleted functionality

* remove savedlistscontent

* update stores

* move logic to hooks

* typescript conversions and list page update

* adjust useeffect and language

* add documentation, minor updates

* fix re-rendering issue

* copy over local lists and entities

* update local to remote copy logic

* update save entity logic

* update alerts

* continue adding alerts

* add save entities button to search page

* update saved items table, add button to table

* adjust button tooltips

* add barrel files

* convert to ts

* continue conversions

* separate out api and store

* update tests

* fix minor uuid bug, adjust menu button

* sort items

* continue to add sorting

* clean up and add changelog

* update list page

* update isLoading bool to pass test

* remove lists page for unauthenticated users

* refactor alerts

* hide list buttons from unauthenticated users

* finish refactoring hooks

* fix new list dialog

* minor updates and extend alerts

* update jest test

* update test and implement copy logic

* update hook to use default export

* update storage description

* minor cleanup

* finish deleting stores

* update logged out description

* add save entity button to processed datasets

* review cleanup 1

* update import

* update hooks

* Austenem/CAT-1135 Update /services (#3687)

* add ukv service

* remove logs

* add changelog

* memoize entity counts

* Austenem/CAT-1113 Add list metrics (#3689)

* add categories and update organ page table

* finish adding tracking

* finish adding tested tracking

* consolidate save entity tracking

* update imports

* add changelog

* add ref

* add additional check

* separate out save entity hook
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants