Skip to content

Commit 9eeaf6a

Browse files
refactor: tighten ownership filter typing
- Change FilterState.ownership to use OwnershipOption literal union type - Use strict comparison (=== false/true) for is_immutable checks - Move type definitions before interface to follow dependency order 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 0168a98 commit 9eeaf6a

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/platform/assets/components/AssetFilterBar.vue

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,6 @@ import { t } from '@/i18n'
6565
import { useAssetFilterOptions } from '@/platform/assets/composables/useAssetFilterOptions'
6666
import type { AssetItem } from '@/platform/assets/schemas/assetSchema'
6767
68-
export interface FilterState {
69-
fileFormats: string[]
70-
baseModels: string[]
71-
sortBy: string
72-
ownership: string
73-
}
74-
7568
const SORT_OPTIONS = [
7669
{ name: t('assetBrowser.sortRecent'), value: 'recent' },
7770
{ name: t('assetBrowser.sortAZ'), value: 'name-asc' },
@@ -92,6 +85,13 @@ type OwnershipOption = (typeof OWNERSHIP_OPTIONS)[number]['value']
9285
9386
const ownershipOptions = [...OWNERSHIP_OPTIONS]
9487
88+
export interface FilterState {
89+
fileFormats: string[]
90+
baseModels: string[]
91+
sortBy: string
92+
ownership: OwnershipOption
93+
}
94+
9595
const { assets = [] } = defineProps<{
9696
assets?: AssetItem[]
9797
}>()
@@ -105,7 +105,7 @@ const { availableFileFormats, availableBaseModels } =
105105
useAssetFilterOptions(assets)
106106
107107
const hasMutableAssets = computed(() =>
108-
assets.some((asset) => !asset.is_immutable)
108+
assets.some((asset) => asset.is_immutable === false)
109109
)
110110
111111
const emit = defineEmits<{

src/platform/assets/composables/useAssetBrowser.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ function filterByBaseModels(models: string[]) {
3838
function filterByOwnership(ownership: string) {
3939
return (asset: AssetItem) => {
4040
if (ownership === 'all') return true
41-
if (ownership === 'my-models') return !asset.is_immutable
42-
if (ownership === 'public-models') return asset.is_immutable
41+
if (ownership === 'my-models') return asset.is_immutable === false
42+
if (ownership === 'public-models') return asset.is_immutable === true
4343
return true
4444
}
4545
}

0 commit comments

Comments
 (0)