Skip to content

Migration guide

v2.0.0

Minimal supported version of effector is v23.0.0. No breaking changes.

v1.0.0

Removed support of effector v21. Now the minimum supported version is v22.1.2. No breaking changes in code.

v0.110

From v0.110.0 patronum removed support of effector v20. Now minimum supported version is v21.4.

Please, before upgrade review release notes of effector v21.

v0.100

From v0.100.0 patronum introduced object arguments form with BREAKING CHANGES.

Terminal window
npm install patronum@0.14.3
# or
yarn add patronum@0.14.3
throttle
import { throttle } from 'patronum/throttle';

Previous version v0.14.x

const throttled = throttle(source, timeout);

Current version v0.102.x

const throttled = throttle({ source, timeout });
// Also you can set target
const throttled2 = createEvent(); // or any unit
throttle({ source, timeout, target: throttled2 });
  • Wrap source and timeout arguments to object
  • Optionally add target parameter

https://github.com/sergeysova/patronum/pull/31

debounce
import { debounce } from 'patronum/debounce';

Previous version v0.14.x

const debounced = debounce(source, timeout);

Current version v0.102.x

const debounced = debounce({ source, timeout });
// Also you can set target
const debounced = createEvent(); // or any unit
debounce({ source, timeout, target: debounced });
  • Wrap source and timeout arguments to object
  • Optionally add target parameter

https://github.com/sergeysova/patronum/pull/38

splitMap
import { splitMap } from 'patronum/split-map';

Previous version v0.14.x

const received = splitMap(nameReceived, {
firstName: (string) => string.split(' ')[0], // string | undefined
lastName: (string) => string.split(' ')[1], // string | undefined
});

Current version v0.102.x

const received = splitMap({
source: nameReceived,
cases: {
firstName: (string) => string.split(' ')[0], // string | undefined
lastName: (string) => string.split(' ')[1], // string | undefined
},
});
  • First argument should be source
  • Second argument should be cases

https://github.com/sergeysova/patronum/pull/41

some
import { some } from 'patronum/some';

Previous version v0.14.x

const $tooBig = some((size) => size > 800, [$width, $height]);

Current version v0.102.x

const $tooBig = some({
predicate: (size) => size > 800,
stores: [$width, $height],
});
  • First argument should be predicate
  • Second argument should be stores

https://github.com/sergeysova/patronum/pull/43

every
import { every } from 'patronum/every';

Previous version v0.14.x

const $result = every(true, [$a, $b, $c]);
const $result = every(() => true, [$a, $b, $c]);

Current version v0.102.x

const $result = every({ predicate: true, stores: [$a, $b, $c] });
const $result = every({ predicate: () => true, stores: [$a, $b, $c] });
  • First argument should be predicate
  • Second argument should be stores

https://github.com/sergeysova/patronum/pull/50

delay
import { delay } from 'patronum/delay';

Previous version v0.14.x

const delayed = delay(unit, 100);
const logDelayed = delay(unit, { time: (payload) => 100 });

Current version v0.102.x

const delayed = delay({
source: unit,
timeout: 100,
});
const delayed = delay({
source: unit,
timeout: (payload) => 100,
});
const delayed = delay({
source: unit,
timeout: $timeout,
});
  • First argument should be source
  • Second argument should be timeout
  • time property from second argument should be timeout
  • timeout can be Store<number>

https://github.com/sergeysova/patronum/pull/51

status
import { status } from 'patronum/status';

Previous version v0.14.x

const $status = status(effect, 'initial');

Current version v0.102.x

const $status = status({ effect, defaultValue: 'initial' });
  • First argument should be effect in object
  • Second argument should be defaultValue and can be optional

https://github.com/sergeysova/patronum/pull/55

reshape
import { reshape } from 'patronum/reshape';

Previous version v0.14.x

const parts = reshape($original, {
length: (string) => string.length,
first: (string) => string.split(' ')[0] || '',
second: (string) => string.split(' ')[1] || '',
});

Current version v0.102.x

const parts = reshape({
source: $original,
shape: {
length: (string) => string.length,
first: (string) => string.split(' ')[0] || '',
second: (string) => string.split(' ')[1] || '',
},
});
  • First argument should be source
  • Second argument should be shape

https://github.com/sergeysova/patronum/pull/57

combineEvents
import { combineEvents } from 'patronum/combine-events';

Previous version v0.14.x

const target = combineEvents([first, second, third]);
const target = combineEvents({
key1: event1,
key2: event2,
});

Current version v0.102.x

const target = combineEvents({ events: [first, second, third] });
const target = combineEvents({
events: {
key1: event1,
key2: event2,
},
});
  • Assign first argument to property events in object

https://github.com/sergeysova/patronum/pull/58

spread
import { spread } from 'patronum/spread';

Previous version v0.14.x

spread(formReceived, {
first: $first,
last: $last,
});
const source = spread({
first: $first,
last: $last,
});

Current version v0.102.x

spread({
source: formReceived,
targets: {
first: $first,
last: $last,
},
});
const source = spread({
targets: {
first: $first,
last: $last,
},
});
  1. If you have two arguments:
  • First argument should be source in object
  • Second argument should be targets
  1. If only one argument:
  • Wrap it to object and assign to targets

https://github.com/sergeysova/patronum/pull/61