Skip to content
On this page

keepFresh since v0.8.0

Refreshes the data in a Query automatically or on demand.

Note

keepFresh operator refreshes only Queries that were started at least once. So, consider calling query.refresh on the app start.

Formulae

keepFresh(query, config)

Config fields:

  • automatically?: true to refresh the data in a Query automatically if any Store that is used in the Query creation is changed.
  • triggers?: Array of Events after which operator starts refreshing the data in the Query.
ts
import { keepFresh } from '@farfetched/core';

keepFresh(query, { automatically: true, triggers: [someExternalEvent] });

TIP

You can use any object that follows the @@trigger-protocol as a trigger in the keepFresh operator's field triggers.

Released under the MIT License.