Course · Lesson 14 of 20

Load a Source fragment

Use remote content when the server should build part of the interface.

Reading · Practice2 sectionsPrerequisites: Call an endpoint
Course contents

Request structure, not just a scalar

A remote declaration asks a @source method to build a fragment. The returned Source becomes the content of the target element. This differs from an endpoint returning a number into Data.

Reactive parameters can request another fragment when the selection changes. Read the target, method and parameters together: they explain which part of the page is replaced and why.

Understand the request boundary

Authored children can appear until the first remote fragment arrives. _if controls readiness; a false condition makes no request and does not automatically erase existing content. Removing the target cancels its request.

Cached remote compares the method and serialized parameters with the relevant in-flight or last-mounted request. It is not a permanent cache of every record previously visited. A return to an earlier record may require another request.

Your turn

Try it yourself

  1. Open Remote and change the selection that drives its details pane.
  2. Identify the target branch in Source and compare the new fragment.
  3. Open Cached remote and follow its documented repeated-parameter experiment.

Check your understanding

If you only need a returned total, should the server build a whole Source fragment?

Show the answer and expected result

Usually a dataRpc returning a value expresses that task directly. Use remote for interface structure supplied by the server. Keep its replacement boundary small and understand the lifetime of the content it replaces.

Working examples and reference