mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-02 03:55:55 +00:00
fix(web): TDZ crash in add-extension (installIconURL before installInfo)
installIconURL was computed above the useState declaration of installInfo, causing "Cannot access 'installInfo' before initialization" (500) on the add-extension page. Move the computation below the state declarations. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -162,19 +162,6 @@ function AddExtensionContent() {
|
||||
: type === 'skill'
|
||||
? t('market.typeSkill')
|
||||
: t('market.typePlugin');
|
||||
|
||||
// Marketplace icon URL for the extension being installed, by type.
|
||||
const buildInstallIconURL = () => {
|
||||
const cloud = getCloudServiceClientSync();
|
||||
const a = installInfo.plugin_author || '';
|
||||
const n = installInfo.plugin_name || '';
|
||||
if (installExtensionType === 'mcp')
|
||||
return cloud.getMCPMarketplaceIconURL(a, n);
|
||||
if (installExtensionType === 'skill')
|
||||
return cloud.getSkillMarketplaceIconURL(a, n);
|
||||
return cloud.getPluginIconURL(a, n);
|
||||
};
|
||||
const installIconURL = buildInstallIconURL();
|
||||
const {
|
||||
addTask,
|
||||
setSelectedTaskId,
|
||||
@@ -191,6 +178,19 @@ function AddExtensionContent() {
|
||||
useState<PluginInstallStatus>(PluginInstallStatus.ASK_CONFIRM);
|
||||
const [installError, setInstallError] = useState<string | null>(null);
|
||||
const [installIconFailed, setInstallIconFailed] = useState(false);
|
||||
|
||||
// Marketplace icon URL for the extension being installed, by type.
|
||||
const installIconURL = (() => {
|
||||
const cloud = getCloudServiceClientSync();
|
||||
const a = installInfo.plugin_author || '';
|
||||
const n = installInfo.plugin_name || '';
|
||||
if (installExtensionType === 'mcp')
|
||||
return cloud.getMCPMarketplaceIconURL(a, n);
|
||||
if (installExtensionType === 'skill')
|
||||
return cloud.getSkillMarketplaceIconURL(a, n);
|
||||
return cloud.getPluginIconURL(a, n);
|
||||
})();
|
||||
|
||||
const [popoverOpen, setPopoverOpen] = useState(false);
|
||||
const [popoverView, setPopoverView] = useState<PopoverView>('menu');
|
||||
const [isDragOver, setIsDragOver] = useState(false);
|
||||
|
||||
Reference in New Issue
Block a user