Skip to content
On this page

v0.4 Cleanup

This release is technical. It includes only deletions of deprecated features and general refactoring of the API. This release intentionally does not include any new features, so you can upgrade your codebase without any pressure.

Migration guide

There are a bunch of breaking changes, but they are all minor and should not affect your code much. Furthermore, they are the soundness as promised. Please read the migration guide carefully before upgrading.

Q: Why breaking changes is necessary now?

A: The best APIs are created on top of real cases, so we've released v0.1 Samet Nangshe 3 months ago to get feedback from the community and collect real use cases. We've got a lot of feedback, and now we are ready to make the API more consistent and predictable.

Effector 22.4

This release requires with Effector 22.4 or higher. If you are using Effector 22.3, you have to upgrade to 22.4.

Use modern overload of retry

retry(config) overload has been deleted in favor of retry(operation, config) to support retrying of Mutations as well as Queries.

How to
ts
retry(
  someQuery, 
  {
    query: someQuery, 
    times: 3,
    delay: 1000,
  }
);

Change signature of mapParams option in retry

mapData now accepts { result, params } object instead of two separate arguments to be consistent with .finished.* Events and Validator.

How to

Function form

ts
function mapper(
  {
    error,
    params,
    meta, 
  },
  meta 
) {
  // ...
}

Object form

ts
const mapper = {
  source: $externalStore,
  fn(
    {
      error,
      params,
      meta, 
    },
    meta, 
    externalSource
  ) {
    // ...
  },
};

Change signature of .finished.success

.finished.success now has a payload of type { result: Data, params: Params } instead of { data: Data, params: Params } to be consistent with .done of Effect.

How to
ts
query.finished.success.watch(
  ({
    data, 
    result, 
  }) => {
    // ...
  }
);

Change signature of Validator

Validator now accepts { result, params } object instead of two separate arguments to be consistent with .finished.* Events.

How to

Function form

ts
function validator(
  result, 
  params, 
  { result, params } 
) {
  // ...
}

Object form

ts
const validator = {
  source: $externalStore,
  fn(
    result, 
    params, 
    { result, params }, 
    externalSource
  ) {
    // ...
  },
};

Change signature of mapper in mapData

mapData now accepts { result, params } object instead of two separate arguments to be consistent with .finished.* Events and Validator.

How to

Function form

ts
function mapper(
  result, 
  params, 
  { result, params } 
) {
  // ...
}

Object form

ts
const mapper = {
  source: $externalStore,
  fn(
    result, 
    params, 
    { result, params }, 
    externalSource
  ) {
    // ...
  },
};

Change signature of mapper in connectQuery

fn now accepts { result } object instead of just a result as first argument in single-parent more. In multi-parent mode, fn now accepts { parentName: { result } } object instead of object with results as first argument.

It will allow us to add more properties to the object in the future without breaking changes, e.g. params of the parent Query.

How to

Single parent

ts
connectQuery({
  source: languagesQuery,
  fn(language) {
    return { params: { lang: language } }; 
    return { params: { lang: language.result } }; 
  },
  target: contentQuery,
});

Multi parent

ts
connectQuery({
  source: { language: languagesQuery, blocks: blocksQuery },
  fn({ language, blocks }) {
    return { params: { lang: language, ids: blocks } }; 
    return { params: { lang: language.result, ids: blocks.result } }; 
  },
  target: contentQuery,
});

Change signature of mappers in mapParams

mapParams now accepts { result, params } object instead of two separate arguments to be consistent with .finished.* Events and Validator.

How to

Function form

ts
function mapper(
  result, 
  params, 
  { result, params } 
) {
  // ...
}

Object form

ts
const mapper = {
  source: $externalStore,
  fn(
    result, 
    params, 
    { result, params }, 
    externalSource
  ) {
    // ...
  },
};

Full changelog

0.4.1

@farfetched/core

Patch Changes

  • 9fb4ead: Export DynamicallySourcedField type
  • b175216: Export FetchingStatus type

0.4.0

@farfetched/react

Minor Changes

  • d92411c: Sync versions of all packages

Patch Changes

  • b352718: Allow in use initialData type in useQuery
  • 3280ab9: Hide private types from published package
@farfetched/core

Minor Changes

  • 77a3832: Decrease bundle size by 36 percent
  • a413bf9: Get rid of patronum, inline required functions
  • 1638921: Change signature of mapper in mapData to be consistent with .finished.* Events
  • d6ab20b: Change signature of Validator to be consistent with .finished.* Events
  • dbd6fee: Change signature of .finished.success to be consistent with .done of Effect
  • d92411c: Sync versions of all packages
  • 6521bc7: Change signature of mapper in connectQuery to add more info about parents in future
  • f6fbc4f: Remove deprecated overload of retry
  • 90102e8: Add TAKE_FIRST strategy in concurrency settings of internal createApiRequest

Patch Changes

  • 8bb8bce: Get rid of @farfetched/misc, inline functions
  • 3280ab9: Hide private types from published package
@farfetched/runtypes

Minor Changes

  • d92411c: Sync versions of all packages

Patch Changes

  • 3280ab9: Hide private types from published package
@farfetched/solid

Minor Changes

  • d92411c: Sync versions of all packages

Patch Changes

  • 8bb8bce: Get rid of @farfetched/misc, inline functions
  • 3280ab9: Hide private types from published package
@farfetched/zod

Minor Changes

  • d92411c: Sync versions of all packages

Patch Changes

  • 3280ab9: Hide private types from published package

Released under the MIT License.