Skip to content
On this page

keepFresh since v0.8

Refreshes the data in a Query automatically or on demand.


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


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.
  • enabled?: since v0.11 Store with the current enabled state. Disabled keepFresh will not execute queries, instead, they will be treated as skipped. Can be true or false.
import { keepFresh } from '@farfetched/core';

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


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.