RouteDestination

RouteDestination contains a ViewSet object. RouteHandler.new() takes a RouteHandlerCallback containing a RouteDestination. RouteHandler.update() takes a RouteHandlerCallback containing a RouteDestination.

Syntax 

1type RouteDestination {
2    viewset: ViewSet;
3}

Properties 

PropertyTypeRequired/OptionalDescription
viewsetA ViewSet objectRequiredA ViewSet object that specifies the view to display.

ViewSet 

The view to display. Supply a ViewSet object to a RouteDestination.

Properties 

PropertyTypeRequired/OptionalDescription
viewNameStringRequiredThe viewName key maps to the viewName property for the outlet. It accepts either:
  • a Promise to a route handler module: { default: import('my/routeHandler') }.
  • a ViewInfo object

In LWR, modules are always provided via a Promise object. Promises allow the module code to be lazily loaded, improving application performance.

Note

Syntax 

ViewSet with Promise
1interface ViewSet {
2    [viewName: string]: (() => Promise<Module>) | ViewInfo;
3}

If a single page reference maps to more than one view, you can specify more than one outlet where each outputs a different view component. For example: { default: import('my/routeHandler'), sidebar: import('my/sideHandler'), footer: import('my/footerHandler') }. Check out Outlets for more information about using multiple outlets.

Note

ViewInfo 

An object containing a Promise to a route handler module and a string specifier for the module. Supply a ViewInfo object to a ViewSet object.

Properties 

PropertyTypeRequired/OptionalDescription
modulePromiseRequiredA promise to a route handler module.
stringStringRequiredA string specifier for the module, like my/recipePage. Simple or straightforward use cases typically don’t require a specifier. In other cases, the specifier for the module can’t be determined from a Promise alone, so you should manually define the module’s string specifier for the route handler.

Syntax 

1interface ViewInfo {
2    module: () => Promise<Module>
3    specifier: string;
4}

See Also

Developer Preview Feature

Feature is available as a developer preview. Feature is not generally available unless or until Salesforce announces its general availability in documentation or in press releases or public statements. All commands, parameters, and other features are subject to change or deprecation at any time, with or without notice. Do not implement functionality developed with these commands or tools.

DID THIS ARTICLE SOLVE YOUR ISSUE?
Let us know so we can improve!