Concorde documentation (crawl) · interactive version

Concorde decorator — @get. Loads data through API.getDetailed. The decorated property is ApiResult<T> | null: request, response (or null for dataProvider(...) resolution without HTTP), and typed result. Doc ID: docs/_decorators/get. Keywords: Concorde, supersoniks, docs/_decorators/get, get, @get, decorator, API.getDetailed, ApiResult | null, request, response, null, dataProvider(...), result, Endpoint, ApiResult. URL: https://concorde.supersoniks.org/crawl/docs/_decorators/get.html.

@get

Loads data through API.getDetailed. The decorated property is ApiResult<T> | null: request, response (or null for dataProvider(...) resolution without HTTP), and typed result.

Pass an Endpoint<T> as the first argument. Import get and ApiResult from @supersoniks/concorde/decorators, and Endpoint from @supersoniks/concorde/utils/endpoint.

Configuration

Dynamic path

${prop} on the endpoint or config key is resolved on the host. While a placeholder is null or undefined, no GET runs. Optional skipEmptyPlaceholder: true also blocks "" (empty string only). Details: Dynamic path placeholders.

Options (GetOptions)

Pass as the second argument (scoped config) or third (with a configuration key). Same shape as send decorators where applicable:

Option Description
skipEmptyPlaceholder Treat "" as not ready (see Dynamic path).
refetchEveryMs Automatic polling interval (ms). 0 or omitted = no polling.
triggerKey DataProviderKeyPublisherManager.get(...).invalidate() on that publisher re-runs the GET.

Manual refetch (triggerKey)

Same pattern as @post: a publisher acts as a signal, independent of the response payload.

import { get, type ApiResult } from "@supersoniks/concorde/decorators";
import { Endpoint } from "@supersoniks/concorde/utils/endpoint";
import { DataProviderKey } from "@supersoniks/concorde/dataProviderKey";
import { dp } from "@supersoniks/concorde/core/utils/PublisherProxy";

const geoCommunesEndpoint = new Endpoint<GeoCommuneRow[]>(
  "communes?limit=5&fields=nom,code",
);
const geoCommunesRefreshKey = new DataProviderKey<void>(
  "docsDemoGeoCommunesRefresh",
);

@get(geoCommunesEndpoint, apiConfigurationKey, {
  triggerKey: geoCommunesRefreshKey,
})
@state()
payload: ApiResult<GeoCommuneRow[]> | null = null;

// Same component or anywhere else:
dp(geoCommunesRefreshKey).invalidate();

Prefer triggerKey over mutating the API configuration publisher when you only want to reload the same URL — no need to touch serviceURL, tokens, etc.

The docs mock adds an X-Fetched-At response header on /docs-mock-api/geo/communes so live demos can show when the last fetch happened (response.headers.get("X-Fetched-At")).

When the GET runs again

Import

import { get, type ApiResult } from "@supersoniks/concorde/decorators";
import { Endpoint } from "@supersoniks/concorde/utils/endpoint";
import { DataProviderKey } from "@supersoniks/concorde/dataProviderKey";

Minimal example

Same demo service as sonic-queue (/docs-mock-api/geo/). Publisher setup lives in decorators-demo-geo.ts and decorators-demo-subscribe-publish-get-demos.ts.

@get(new Endpoint<User>("users/${userId}"))
@state()
payload: ApiResult<User> | null = null;

Live demos

@get with triggerKey — refresh button + X-Fetched-At timestamp in the UI:

<docs-demo-sources for="demo-api-get"></docs-demo-sources>
    <demo-api-get></demo-api-get>

Dynamic config and endpoint path. Manual refetch is triggered from a separate component (same triggerKey publisher):

<docs-demo-sources for="demo-api-get-configuration-key"></docs-demo-sources>
    <demo-api-get-configuration-key></demo-api-get-configuration-key>
    <demo-api-get-refresh-remote></demo-api-get-refresh-remote>

Scoped @get with @publish / @subscribe on the payload (see @publish and @subscribe) — wrap under an ancestor with serviceURL="/docs-mock-api/geo/":

<div serviceURL="/docs-mock-api/geo/">
  <docs-demo-sources for="demo-api-get-publish-subscribe"></docs-demo-sources>
  <demo-api-get-publish-subscribe></demo-api-get-publish-subscribe>
</div>

Stale responses are ignored if the path or generation changed before the request finished.

See also