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

crypto.randomUUID() errors from multiple components #1136

Closed
srozen opened this issue Nov 26, 2024 · 2 comments · Fixed by #1137
Closed

crypto.randomUUID() errors from multiple components #1136

srozen opened this issue Nov 26, 2024 · 2 comments · Fixed by #1137
Labels
bug Something isn't working refactoring This involves some refactoring of existing code.

Comments

@srozen
Copy link

srozen commented Nov 26, 2024

Overview of the problem

Oruga versions:

Description

Extensive calls to crypto.randomUUID() in multiple components, which for some cannot be avoided as far as I know.
This means errors in production for all components that resort to normalizeOptions in packages/oruga/src/composables/useOptions.ts.

Some components like Datepicker or Datetimepicker are using the Select in their template, which in turns make that call.

Steps to reproduce

  1. Use Datetimepicker
  2. Run in an unsafe production context
@mlmoravek
Copy link
Member

Hey, what error is shown ? And what is an unsafe production context?

@srozen
Copy link
Author

srozen commented Nov 26, 2024

Hello!

From the doc here https://developer.mozilla.org/en-US/docs/Web/API/Crypto/randomUUID

This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.

Therefore, any component calling that in a HTTP (no S) context will get the following error :
image

I get the idea of the usage of randomUUID to have default keys on component that will expose some collection of data such as Select, Table, etc, but it then breaks in "prod" if you don't have a secure context.

@mlmoravek mlmoravek added the refactoring This involves some refactoring of existing code. label Nov 26, 2024
@mlmoravek mlmoravek added the bug Something isn't working label Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working refactoring This involves some refactoring of existing code.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants