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

Configure Ember Data ID Generation #19428

Merged
merged 4 commits into from
Mar 2, 2023

Conversation

zofskeez
Copy link
Contributor

@zofskeez zofskeez commented Mar 2, 2023

Ember Data started using the uuidv4 library for ID generation which uses crypto.getRandomUUID which is not available in unsecure contexts. There was a polyfill added in 4.6.2, but until we can upgrade an initializer has been created to configure the id generation method using the uuid library which was brought in to replace crypto in our codebase.

More information in this Ember Data issue

@zofskeez zofskeez added ui bug Used to indicate a potential bug backport/1.13.x labels Mar 2, 2023
@zofskeez zofskeez added this to the 1.13.1 milestone Mar 2, 2023
// the uuid library was brought in to replace other usages of crypto in the app so it is safe to use in unsecure contexts
setIdentifierGenerationMethod((resource) => {
return resource.lid || uuidv4();
// adapted from defaultGenerationMethod -- https://github.com/emberjs/data/blob/v4.5.0/packages/store/addon/-private/identifier-cache.ts#LL82-L94C2
Copy link
Contributor

Choose a reason for hiding this comment

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

thanks for adding this!

Copy link
Contributor

@hellobontempo hellobontempo left a comment

Choose a reason for hiding this comment

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

Nice work on all this!! 🚀

@zofskeez zofskeez merged commit 16e9c14 into main Mar 2, 2023
@zofskeez zofskeez deleted the ui/VAULT-14002/ember-data-id-generation branch March 2, 2023 20:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Used to indicate a potential bug ui
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants