Skip to content
On this page

v0.9 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 almost a year 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.

Do not use externalCache adapter

externalCache adapter was deprecated in 0.8, write your own adapter instead by recipe.

Read-only Stores and Events

Events finished.* have never been supposed to be called in application code. Now they are read-only. In case you call them, you will get a warning in console in Effector 22 and exception in Effector 23.

Stores $data, $error, $status, $idle, $pending, $succeeded, $failed, $enabled have never been supposed to be changed in application code directly. Now they are read-only. In case you change them, you will get a warning in console in Effector 22 and exception in Effector 23.

Separate Event for Query cancelation

Cancelled Queries were treated as failed before this release. We have added a separate Event .aborted to Query to distinguish between cancelation and failure. It is recommended to use .aborted instead of .finished.failure to handle cancelation.

WARNING

In the next release v0.10 cancelation will not be treated as failure anymore, so you will have to handle it explicitly.

supressIntermediateErrors in retry operator

Before this release, retry operator was marking Query as failed on every failed attempt. Since v0.9 it accepts options supressIntermediateErrors to overwrite this behavior. If true, then the Query will not be marked as failed until the last attempt is failed.

WARNING

In the next release v0.10 supressIntermediateErrors will be true true by default. To restore the previous behavior, you will have to set it to false explicitly.

Re-worked Sourced internal implementation

Before Sourced fields internally were represented as Stores with a final value of a field, which value changes fast right before read. This scheme was based on Effector's computation priority and served well for a long time. But it had a few drawbacks:

After v0.9 Sourced fields internally is represented as Stores with a function return final value of a field. It is more stable and less error-prone.

If you use normalizeSourced or combineSourced in your code, you may need to update it to the new API. Examples can be found in the PR. Since normalizeSourced and combineSourced are low-level undocumented functions, we do not provide a migration guide for them.

Full changelog

0.9.0

@farfetched/core

Minor Changes

  • 961f32f: Allow passing array of codes to isHttpErrorCode
  • a5f4f38: Add Event .started to Query and Mutation
  • e632dca: Support custom serialization in localStorageCache and sessionStorageCache
  • 7e909d2: Add Event aborted to Query
  • faa19ec: Mark read-only Events and Stores with readonly
  • ca20587: Add Store .$finished to Remote Operation
  • 7448b5c: Delete externalCache
  • 1ec644e: Add option supressIntermediateErrors to retry operator
  • f759034: Add info about Query status and corresponding data to .finished.finally Event

Patch Changes

  • 3ecc6ea: Rework internal structure of sourced fields to fix race-condition in attachOperation
  • 43917a7: Add ExecutionMeta to otherwise Event in retry operator

Released under the MIT License.