MCPcopy
hub / github.com/wavetermdev/waveterm / handleSelectApp

Function handleSelectApp

frontend/builder/app-selection-modal.tsx:123–147  ·  view source on GitHub ↗
(appId: string)

Source from the content-addressed store, hash-verified

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}`;

Callers 1

AppSelectionModalFunction · 0.85

Calls 5

getApiFunction · 0.90
getMethod · 0.80
setMethod · 0.80
SetRTInfoCommandMethod · 0.65

Tested by

no test coverage detected