Skip to content

Commit

Permalink
Add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Dec 19, 2021
1 parent 104ad91 commit 76255aa
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/combination/ids/namespace.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@ import { getCombDimensions } from '../dimensions.js'
import { getDimensionId, setDimensionId } from './get.js'
import { isSameId, isSameDimension, hasCrossDimensionsIds } from './has.js'

// We previously ensured that each `id` is unique within each dimension.
// This logic ensures each `id` is also unique across dimensions.
// We previously ensured that each `id` is unique across dimensions of a given
// result, when the result is created
// This logic ensures each `id` is also unique across dimensions of all results.
// We do this by prefixing the dimension's name to the `id` when we find
// cross-dimensions duplicates.
// - If the prefixed `id` is still a duplicate, which is very unlikely, we add
// additional prefixes until it stops being a duplicate.
// We only do so on the previous result's id, not on the most recent, so those
// ids look simpler to users.
// Since the number of results can be large, this is optimized for performance.
Expand Down

0 comments on commit 76255aa

Please sign in to comment.