Skip to content

Commit

Permalink
move computation from variable to it using
Browse files Browse the repository at this point in the history
  • Loading branch information
artalar committed Sep 5, 2022
1 parent 9dcbd7e commit 7b1a19a
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/core/hash.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,18 @@ export let hash = (compiled, sheet, global, append, keyframes) => {
);
}

// If the global flag is set, save the current stringified and compiled CSS to `cache.g`
// to allow replacing styles in <style /> instead of appending them.
// This is required for using `createGlobalStyles` with themes
let cssToReplace = global && cache.g ? cache.g : null;
if (global) cache.g = cache[className];

// add or update
update(cache[className], sheet, append, cssToReplace);
update(
cache[className],
sheet,
append,
// If the global flag is set, save the current stringified and compiled CSS to `cache.g`
// to allow replacing styles in <style /> instead of appending them.
// This is required for using `createGlobalStyles` with themes
global && cache.g ? cache.g : null
);

if (global) cache.g = cache[className];

// return hash
return className;
Expand Down

0 comments on commit 7b1a19a

Please sign in to comment.