Skip to content

Commit

Permalink
Allow using _Query_ with initialData in keepFresh
Browse files Browse the repository at this point in the history
  • Loading branch information
igorkamyshev committed Apr 6, 2023
1 parent 8bf8b77 commit fa0727a
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/wise-dolls-warn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@farfetched/core': patch
---

Allow using _Query_ with `initialData` in `keepFresh`
14 changes: 14 additions & 0 deletions packages/core/src/trigger_api/__test__/keep_fresh.test-d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { describe, test } from 'vitest';

import { Query } from '../../query/type';
import { keepFresh } from '../keep_fresh';

describe('keepFresh', () => {
test('supports Query with initialData', () => {
const q = {} as unknown as Query<number, string, string, string>;

keepFresh(q, { automatically: true });
keepFresh(q, { triggers: [] });
keepFresh(q, { automatically: true, triggers: [] });
});
});
8 changes: 4 additions & 4 deletions packages/core/src/trigger_api/keep_fresh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,29 @@ import {
import { type TriggerProtocol } from './trigger_protocol';

export function keepFresh<Params>(
query: Query<Params, any, any>,
query: Query<Params, any, any, any>,
config: {
automatically: true;
}
): void;

export function keepFresh<Params>(
query: Query<Params, any, any>,
query: Query<Params, any, any, any>,
config: {
triggers: Array<Event<unknown> | Event<void> | TriggerProtocol>;
}
): void;

export function keepFresh<Params>(
query: Query<Params, any, any>,
query: Query<Params, any, any, any>,
config: {
automatically: true;
triggers: Array<Event<unknown> | Event<void> | TriggerProtocol>;
}
): void;

export function keepFresh<Params>(
query: Query<Params, any, any>,
query: Query<Params, any, any, any>,
config: {
automatically?: true;
triggers?: Array<Event<unknown> | Event<void> | TriggerProtocol>;
Expand Down

0 comments on commit fa0727a

Please sign in to comment.