Skip to content

Commit 9cdffdf

Browse files
committed
fix: simplify component preview URL generation in PreviewUtils
1 parent db7354b commit 9cdffdf

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

src/shared/previewUtils.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -229,9 +229,7 @@ export class PreviewUtils {
229229
componentName?: string,
230230
targetOrg?: string
231231
): string[] {
232-
let appPath = `lwr/application/e/devpreview/ai/${encodeURIComponent(
233-
'localdev%2Fpreview'
234-
)}?ldpServerUrl=${ldpServerUrl}&ldpServerId=${ldpServerId}`;
232+
let appPath = `lwr/application/e/devpreview/ai/localdev-preview?ldpServerUrl=${ldpServerUrl}&ldpServerId=${ldpServerId}`;
235233
if (componentName) {
236234
// TODO: support other namespaces
237235
appPath += `&specifier=c/${componentName}`;
@@ -253,19 +251,15 @@ export class PreviewUtils {
253251
* @param ldpServerUrl The URL for the local dev server
254252
* @param ldpServerId Record ID for the identity token
255253
* @param componentName The name of the component to preview
256-
* @param encodePath Whether to encode the path
257254
* @returns The full URL for the component preview
258255
*/
259256
public static generateComponentPreviewUrl(
260257
instanceUrl: string,
261258
ldpServerUrl: string,
262259
ldpServerId: string,
263-
componentName?: string,
264-
encodePath = false
260+
componentName?: string
265261
): string {
266-
let url = `${instanceUrl}/lwr/application/e/devpreview/ai/${
267-
encodePath ? encodeURIComponent('localdev%2Fpreview') : 'localdev%2Fpreview'
268-
}?ldpServerUrl=${ldpServerUrl}&ldpServerId=${ldpServerId}`;
262+
let url = `${instanceUrl}/lwr/application/e/devpreview/ai/localdev-preview?ldpServerUrl=${ldpServerUrl}&ldpServerId=${ldpServerId}`;
269263
if (componentName) {
270264
// TODO: support other namespaces
271265
url += `&specifier=c/${componentName}`;

0 commit comments

Comments
 (0)