Compare commits

...

2 Commits

Author SHA1 Message Date
CodeRabbit Fixer
c98a687ae5 fix: Optimize histogramToPath percentile calculation with QuickSelect algorithm (#9109)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 19:09:38 +01:00
AustinMroz
55b8236c8d Fix localization on share and hide entry (#9395)
A placeholder share entry was added in #9368, but the localization for
this share label was then removed in #9361.

This localization is re-added in a location that is less likely to be
overwritten and the menu item is set to hidden. I'll manually connect it
to the workflow sharing feature flag in a followup PR after that has
been merged.

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-9395-Fix-localization-on-share-and-hide-entry-3196d73d36508146a343f625a5327bdd)
by [Unito](https://www.unito.io)
2026-03-06 09:35:18 -08:00
3 changed files with 30 additions and 6 deletions

View File

@@ -84,6 +84,30 @@ export function createMonotoneInterpolator(
}
}
function quickSelect(arr: Uint32Array, k: number): number {
let lo = 0
let hi = arr.length - 1
while (lo < hi) {
const pivot = arr[hi]
let i = lo
for (let j = lo; j < hi; j++) {
if (arr[j] <= pivot) {
const tmp = arr[i]
arr[i] = arr[j]
arr[j] = tmp
i++
}
}
const tmp = arr[i]
arr[i] = arr[hi]
arr[hi] = tmp
if (i === k) return arr[i]
else if (i < k) lo = i + 1
else hi = i - 1
}
return arr[lo]
}
/**
* Convert a 256-bin histogram into an SVG path string.
* Normalizes using the 99.5th percentile to avoid outlier spikes.
@@ -91,8 +115,8 @@ export function createMonotoneInterpolator(
export function histogramToPath(histogram: Uint32Array): string {
if (!histogram.length) return ''
const sorted = Array.from(histogram).sort((a, b) => a - b)
const max = sorted[Math.floor(255 * 0.995)]
const copy = new Uint32Array(histogram)
const max = quickSelect(copy, Math.floor(255 * 0.995))
if (max === 0) return ''
const invMax = 1 / max

View File

@@ -189,11 +189,10 @@ export function useWorkflowActionsMenu(
addItem({
id: 'share',
label: t('menuLabels.Share'),
label: t('breadcrumbsMenu.share'),
icon: 'icon-[comfy--send]',
command: async () => {},
disabled: true,
visible: isRoot
visible: false
})
addItem({

View File

@@ -2604,7 +2604,8 @@
"deleteWorkflow": "Delete Workflow",
"deleteBlueprint": "Delete Blueprint",
"enterNewName": "Enter new name",
"missingNodesWarning": "Workflow contains unsupported nodes (highlighted red)."
"missingNodesWarning": "Workflow contains unsupported nodes (highlighted red).",
"share": "Share"
},
"shortcuts": {
"shortcuts": "Shortcuts",