Live-Reload Fails to Update Child Components with Dynamic Imports in Salesforce LocalDev for Experience Sites
@nrkruk is already working on this.
Since Nov 8, 2024.
Assessment
This issue has not been assessed yet.
Description
Summary
Live-reload functionality in Salesforce LocalDev does not refresh child components when the main component published to an Experience Website uses dynamic imports. Specifically, if a component is dynamically imported (e.g., import('c/dynamicComponent')), any changes made to the dynamically imported child component (or any other non-dynamically imported child component) are not recompiled or published as expected during live-reload.
Steps To Reproduce:
-
Set up a main component (WebsiteMain) that dynamically imports child components using
import('c/childComponent'). -
Publish the main component to an Experience Website and initiate live reload using the command:
sf lightning dev site --target-org dev --name "MyWebsite" -
Make a change to the dynamically imported child component, or any other child component (e.g., childComponent).
-
Observe that live reload does not pick up changes made to any child component.
Expected Result
When a change is made to any child component and the parent utilizes a dynamically imported component, live-reload should refresh and apply the changes across all relevant components, including any dynamically imported child components.
Actual Result
Live-reload does not detect or apply changes made to any child components other than the main component that utilizes the main site. All child components (even those that are not dynamically imported) appear to remain unaffected by these changes during live-reload.
Additional Information
Code Sample
Here’s an example of the WebsiteMain component, illustrating the dynamic import setup:
import { CurrentPageReference } from 'lightning/navigation';
import { LightningElement, track, wire } from 'lwc';
export default class WebsiteMain extends LightningElement {
@track currentPage = null; // Current page's object
@track dynamicComponent = null; // Holds the dynamically imported component constructor
myDynamicPages = [
{
id: 1,
name: "Basic Information",
path: "BasicInformation",
component: () => import('c/childComponent'),
showPageNavbar: false
}, ...
];
}
async loadComponent(page) {
const componentModule = await page.component();
this.dynamicComponent = componentModule.default;
}
Screenshots:
None
Logs:
No logs are created (even when DEBUG=* is set) when modifying a child component with dynamic imports utilized.
System Information
SF CLI:
{
"architecture": "win32-x64",
"cliVersion": "@salesforce/cli/2.63.8",
"nodeVersion": "node-v20.17.0",
"osVersion": "Windows_NT 10.0.22635",
"rootPath": "C:\\Users\\BradyNadeau\\AppData\\Local\\sf\\client\\2.63.8-fbf82e0",
"shell": "cmd.exe",
"pluginVersions": [
"@oclif/plugin-autocomplete 3.2.6 (core)",
"@oclif/plugin-commands 4.1.3 (core)",
"@oclif/plugin-help 6.2.15 (core)",
"@oclif/plugin-not-found 3.2.22 (core)",
"@oclif/plugin-plugins 5.4.15 (core)",
"@oclif/plugin-search 1.2.12 (core)",
"@oclif/plugin-update 4.6.4 (core)",
"@oclif/plugin-version 2.2.15 (core)",
"@oclif/plugin-warn-if-update-available 3.1.19 (core)",
"@oclif/plugin-which 3.2.16 (core)",
"@salesforce/cli 2.63.8 (core)",
"apex 3.5.4 (core)",
"api 1.3.1 (core)",
"auth 3.6.68 (core)",
"data 3.7.1 (core)",
"deploy-retrieve 3.15.3 (core)",
"info 3.4.12 (core)",
"lightning-dev 1.9.0 (user) published 19 days ago (Fri Oct 11 2024)",
"limits 3.3.33 (core)",
"marketplace 1.2.26 (core)",
"org 4.7.0 (core)",
"packaging 2.8.12 (core)",
"schema 3.3.36 (core)",
"settings 2.3.24 (core)",
"signups 2.5.23 (user) published 17 days ago (Sat Oct 12 2024)",
"sobject 1.4.42 (core)",
"source 3.5.21 (core)",
"telemetry 3.6.16 (core)",
"templates 56.3.24 (core)",
"trust 3.7.34 (core)",
"user 3.5.33 (core)"
]
}
OS:
Experience Sites Only:
{
"orgId": "00D7X000000URjZ",
"siteId": "0DMOt0000004igo",
"clwrVersion": "252.131",
"coreVersion": "252.11",
"coreChangelist": "49784824",
"bundleGenerationDate": "Oct 30, 2024 10:47:36 PM",
"siteTemplateName": "talon-template-byo",
"deployTarget": "CORE"
}
- Dominant language
- TypeScript
- Stars
- 19
- Forks
- 19
- Avg merge
- 3d 12h
- Merged PRs (30d)
- 2
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from salesforcecli/plugin-lightning-dev
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
salesforcecli/plugin-lightning-dev#686 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 42/100
salesforcecli/plugin-lightning-dev#627 · 2 comments · 1 reaction ·
-
BUG P2
Difficulty 3/5 1-2 days Newbie friendliness 45/100
salesforcecli/plugin-lightning-dev#544 · 4 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
salesforcecli/plugin-lightning-dev#456 · 1 reaction ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
All issues in salesforcecli/plugin-lightning-dev
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
bug v2
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
modelcontextprotocol/inspector#2458 · 1 comment ·
-
Difficulty 1/5 Under an hour Newbie friendliness 75/100
railmapgen/rmp-gallery#4068 ·
-
Mend: dependency security vulnerability status: needs triage 🕵️♀️
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
carbon-design-system/ibm-products#9907 ·