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

[MDCCheckbox] Replace unique-id with a deterministic function #5284

Open
jathak opened this issue Nov 27, 2019 · 0 comments

Comments

@jathak
Copy link

@jathak jathak commented Nov 27, 2019

Feature Request

mdc-checkbox currently uses the built-in unique-id function when generating keyframes. This function is non-deterministic, which can hurt caching when using mdc-checkbox in a complicated build.

Proposed solution

To make the result of compiling mdc-checkbox deterministic, we can replace this call to unique-id with a call to a user-defined function similar to:

$_next-id: 0 !default;

@function deterministic-unique-id() {
  $_next-id: $_next-id + 1 !global;
  @return u#{$_next-id};
}

Alternatives considered

An alternative would be to add a method to seed randomness in the Sass compiler (for both unique-id and random) but the main benefit of these functions being something built-in is that they're likely to be unique across compiler runs as well.

Additional context

b/145002342 has internal context on this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.