Skip to content

Commit 35f5773

Browse files
[bugfix] Fix invalid ManagerChannel enum value in nodepack installation (#5312)
* [bugfix] Fix invalid ManagerChannel enum value in nodepack installation Fix nodepack installation failure caused by using 'stable' channel value which is not defined in the ManagerChannel enum. Changed from 'stable' to 'default' which is a valid enum value according to the backend schema. Fixes nodepack installation requests that were failing validation at /v2/manager/queue/task endpoint. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * [refactor] Enforce type safety for enum values without type assertions Remove type assertions (as ManagerChannel) and use explicit Record typing to ensure compile-time validation of enum values. This prevents invalid enum values from being used by catching them during TypeScript compilation rather than runtime validation failures. - Replace type assertions with Record<string, ManagerChannel> typing - Remove manual casting that bypassed TypeScript's type checking - Ensure invalid enum values cause compilation errors --------- Co-authored-by: Claude <[email protected]>
1 parent 65b6b27 commit 35f5773

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/components/dialog/content/manager/PackVersionSelectorPopover.vue

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -109,15 +109,15 @@ const SelectedVersionValues = {
109109
NIGHTLY: 'nightly' as SelectedVersion
110110
}
111111
112-
const ManagerChannelValues = {
113-
STABLE: 'stable' as ManagerChannel,
114-
DEV: 'dev' as ManagerChannel
112+
const ManagerChannelValues: Record<string, ManagerChannel> = {
113+
DEFAULT: 'default', // ✅ Valid - will compile
114+
DEV: 'dev' // ✅ Valid - will compile
115115
}
116116
117-
const ManagerDatabaseSourceValues = {
118-
CACHE: 'cache' as ManagerDatabaseSource,
119-
REMOTE: 'remote' as ManagerDatabaseSource,
120-
LOCAL: 'local' as ManagerDatabaseSource
117+
const ManagerDatabaseSourceValues: Record<string, ManagerDatabaseSource> = {
118+
CACHE: 'cache',
119+
REMOTE: 'remote',
120+
LOCAL: 'local'
121121
}
122122
123123
const { nodePack } = defineProps<{
@@ -242,7 +242,7 @@ const handleSubmit = async () => {
242242
await managerStore.installPack.call({
243243
id: nodePack.id,
244244
repository: nodePack.repository ?? '',
245-
channel: ManagerChannelValues.STABLE,
245+
channel: ManagerChannelValues.DEFAULT,
246246
mode: ManagerDatabaseSourceValues.CACHE,
247247
version: actualVersion,
248248
selected_version: selectedVersion.value

0 commit comments

Comments
 (0)