(appId: string)
| 121 | }; |
| 122 | |
| 123 | const handleSelectApp = async (appId: string) => { |
| 124 | let appIdToUse = appId; |
| 125 | |
| 126 | // If selecting a local app, convert it to a draft first |
| 127 | if (appId.startsWith("local/")) { |
| 128 | try { |
| 129 | const result = await RpcApi.MakeDraftFromLocalCommand(TabRpcClient, { localappid: appId }); |
| 130 | appIdToUse = result.draftappid; |
| 131 | } catch (err) { |
| 132 | console.error("Failed to create draft from local app:", err); |
| 133 | setError(`Failed to create draft from ${appId}: ${err.message || String(err)}`); |
| 134 | return; |
| 135 | } |
| 136 | } |
| 137 | |
| 138 | const builderId = globalStore.get(atoms.builderId); |
| 139 | const oref = WOS.makeORef("builder", builderId); |
| 140 | await RpcApi.SetRTInfoCommand(TabRpcClient, { |
| 141 | oref, |
| 142 | data: { "builder:appid": appIdToUse }, |
| 143 | }); |
| 144 | globalStore.set(atoms.builderAppId, appIdToUse); |
| 145 | document.title = `WaveApp Builder (${appIdToUse})`; |
| 146 | getApi().setBuilderWindowAppId(appIdToUse); |
| 147 | }; |
| 148 | |
| 149 | const handleCreateNew = async (appName: string) => { |
| 150 | const draftAppId = `draft/${appName}`; |
no test coverage detected