Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions src/commands/lightning/dev/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,7 @@ export default class LightningDevComponent extends SfCommand<ComponentPreviewRes
// strip trailing slashes
const instanceUrl = connection.instanceUrl.replace(/\/$/, '');

const previewUrl = PreviewUtils.generateComponentPreviewUrl(
instanceUrl,
ldpServerUrl,
ldpServerId,
componentName,
false
);
const previewUrl = PreviewUtils.generateComponentPreviewUrl(instanceUrl, ldpServerUrl, ldpServerId, componentName);

// Prepare the result for JSON output
const result: ComponentPreviewResult = {
Expand Down
12 changes: 3 additions & 9 deletions src/shared/previewUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,7 @@ export class PreviewUtils {
componentName?: string,
targetOrg?: string
): string[] {
let appPath = `lwr/application/e/devpreview/ai/${encodeURIComponent(
'localdev%2Fpreview'
)}?ldpServerUrl=${ldpServerUrl}&ldpServerId=${ldpServerId}`;
let appPath = `lwr/application/e/devpreview/ai/localdev-preview?ldpServerUrl=${ldpServerUrl}&ldpServerId=${ldpServerId}`;
if (componentName) {
// TODO: support other namespaces
appPath += `&specifier=c/${componentName}`;
Expand All @@ -253,19 +251,15 @@ export class PreviewUtils {
* @param ldpServerUrl The URL for the local dev server
* @param ldpServerId Record ID for the identity token
* @param componentName The name of the component to preview
* @param encodePath Whether to encode the path
* @returns The full URL for the component preview
*/
public static generateComponentPreviewUrl(
instanceUrl: string,
ldpServerUrl: string,
ldpServerId: string,
componentName?: string,
encodePath = false
componentName?: string
): string {
let url = `${instanceUrl}/lwr/application/e/devpreview/ai/${
encodePath ? encodeURIComponent('localdev%2Fpreview') : 'localdev%2Fpreview'
}?ldpServerUrl=${ldpServerUrl}&ldpServerId=${ldpServerId}`;
let url = `${instanceUrl}/lwr/application/e/devpreview/ai/localdev-preview?ldpServerUrl=${ldpServerUrl}&ldpServerId=${ldpServerId}`;
if (componentName) {
// TODO: support other namespaces
url += `&specifier=c/${componentName}`;
Expand Down
Loading