effector

Business logic with ease ☄️

MIT License

Downloads
370.3K
Stars
4.5K
Committers
151
effector - effector-solid 0.22.5

Published by igorkamyshev about 2 years ago

  • Add export of Provider from main module
effector - effector-react 22.2.0

Published by igorkamyshev about 2 years ago

What's Changed

  • Made hook useUnit isomorphic, now it would use scope from the Provider if it is available and scope-less mode otherwise (PR #776 and PR #785)
  • Added parameter forceScope to all hooks to force usage of scope from Provider, it would throw an error if Provider is not available (PR #776 and PR #785), /scope module sets forceScope to true by default
  • Added "type" entry for package exports (PR #759)
  • Fixed typing in useUnit (PR #747)

New Contributors

effector - effector-solid 0.22.4

Published by igorkamyshev about 2 years ago

What's New

  • Made useUnit isomorphic, now it would use scope from the Provider if it is available and scope-less mode otherwise (PR #782)
  • Added parameter forceScope to useUnit to force usage of scope from Provider, it would throw an error if Provider is not available (PR #782), /scope module sets forceScope to true by default

New Contributors

effector - effector-vue 22.1.2

Published by zerobias about 2 years ago

Bug fixes

  • Added "type" entry for package exports by @rachaeldawn (PR #759)
effector - effector-solid 0.22.3

Published by zerobias about 2 years ago

Bug fixes

  • Added "type" entry for package exports by @rachaeldawn (PR #759)
effector - forest 0.21.2

Published by zerobias about 2 years ago

Bug fixes

  • Added "type" entry for package exports by @rachaeldawn (PR #759)
effector - effector-react 22.1.6

Published by zerobias about 2 years ago

Bug fixes

  • Improve useUnit types by @Drevoed in #747
effector - effector-solid 0.22.2

Published by zerobias about 2 years ago

Bug fixes

  • Improve useUnit types by @Drevoed in #747
effector - [email protected]

Published by sergeysova about 2 years ago

effector - effector-react 22.1.0

Published by sergeysova over 2 years ago

What's Changed

  • Added support for react 18 (PR #655)
  • Added useUnit method to read multiple stores and bind events or effects to scope in a single batched call (PR #733, #738)
import {createEvent, createStore, fork} from 'effector'
import {useUnit, Provider} from 'effector-react/scope'

const inc = createEvent()
const $count = createStore(0)
const $title = createStore('useStore example')

$count.on(inc, x => x + 1)

const App = () => {
  const [count, title, incFn] = useUnit([$count, $title, inc])
  return (
    <>
      <h1>{title}</h1>
      <p>Count: {count}</p>
      <button onClick={() => incFn()}>increment</button>
    </>
  )
}

const scope = fork()

render(
  () => (
    <Provider value={scope}>
      <App />
    </Provider>
  ),
  document.getElementById('root'),
)
  • Added placeholder option to useList to render in cases of empty list
const ChatList = () => (
  <div>
    {useList($chats, {
      fn: (chat) => <div>Chat {chat.name}</div>,
      keys: [],
      placeholder: <div>You have no chats yet. Add first one?</div>
    })}
  </div>
)
  • Added defaultValue option to useStoreMap to return in cases when fn returns undefined
const ChatName = ({id}) => {
  const chat = useStoreMap({
    store: $chats,
    keys: [id],
    fn: (chats) => chats.find((chat) => chat.id === id),
    defaultValue: {id: 'default', name: 'Default chat'},
  })
  return <span>{chat.name}</span>
}
  • Fixed Gate.status store being serialized (PR #683)

Documentation Updates

New Contributors

Full Changelog: https://github.com/effector/effector/compare/[email protected]@22.1.0

effector - effector 22.3.0

Published by sergeysova over 2 years ago

Features

New Contributors

Full Changelog: https://github.com/effector/effector/compare/[email protected]@22.3.0

effector - forest 0.21.1

Published by sergeysova over 2 years ago

Bug fixes

Fixed bug with wrong behaviour of classList with static object values #649

effector - forest 0.21.0

Published by sergeysova over 2 years ago

Features

Added support for classList in h() and spec() #638

CSS classes can be merged and applied via multiple spec() calls:

h('div', {
  attr: { class: "basic" },
  classList: ["another"],
  fn() {
    spec({ classList: { first: true, second: false } })
    spec({ classList: ['second', 'third'] })
  },
})

Result will be:

<div class="basic another first second third"></div>
effector - effector Halley 22.2.0

Published by zerobias over 2 years ago

  • Added filter option to sample, thereby making guard an alias (issue #521)
sample({
  clock: submitPasswordEvent,
  source: $store,
  filter: (state: AuthFlowState) => state is WaitingPasswordState,
  fn: (waitingPasswordState, clock) => waitingPasswordState.password,
  target: submitPassowrdFx,
})
  • Added clock option to split (issue #537)
split({
  clock: submit,
  source: $form,
  match: $mode,
  cases: {
    draft: saveFormDraftFx,
    send: sendFormToBackendFx,
  }
})
  • Improved sample type checking:
    • Fixed cases when target units becomes compatible with any type (issue #600)
    • Fixed cases when method call being marked as error when it perfectly correct
    • Removed vague "incompatible unit in target" error
    • Error messages now explicitly tells which type is given by source and which one is expected by target
    • 16 overloads was merged into single one to improve clarity of error messages. Will remove a lot of noise from IDE output thereby improving developer expirience
  • Improved split type checking:
    • Fixed a case when units in cases becomes compatible with any type
    • Removed vague "incompatible unit in target" error
    • Error messages now explicitly tells which type is given by source and which one is expected by failed target case
  • Added jsdoc documentation for all top level methods. Will be used by IDE such as VS Code and Webstorm to provide better developer expirience
  • Derived units in target of sample, guard, split and forward are deprecated (issue #563)
  • Imperative calls of derived units created by merge, sample and split are deprecated
  • Imperative calls of events and effects in pure functions are deprecated (issue #541)
  • restore($store) is deprecated (issue #571)
  • Effects created by attach got correct name for use in developer tools like effector-logger (issue #527)
  • Fixed a case when sample/guard pass obsolete data from it's source store (issue #544)
  • Fixed data race when using combine with fork api (issue #613)
  • Fixed cases when effector/babel-plugin changes function calls which it should avoid (issue #603)
  • Fixed support for multiple passes of effector/babel-plugin (issue #601)
  • Fixed combine support for units with large union types (issue #531)
  • Fixed support for calls without payload for Event<unknown> (PR #454)
  • Fixed circular reference warning during import of typings (issue #578)
effector - effector-vue 22.1.0

Published by zerobias almost 3 years ago

New features

effector - effector-react 22.0.6

Published by zerobias almost 3 years ago

Bugfixes

  • Fix Can't perform a React state update on an unmounted component warning for useStoreMap in a few cases (issue #574)
effector - effector 22.1.2

Published by sergeysova about 3 years ago

effector - effector 22.1.1

Published by zerobias about 3 years ago

  • Fix data races that cause obsolete states to appear in the .on and .reset methods
effector - effector 22.1.0

Published by sergeysova about 3 years ago

  • Added option debugSids to effector/babel-plugin

The option allows adding file path and variable name to a sid for each unit definition.
It allows to easily debug serialized scope using SSR.

effector - effector 22

Published by zerobias about 3 years ago

effector 22.0.0

  • Add support for plain functions to attach: attach({source, async effect(source, params) {}})
  • Allow to use fork without domains: const scope = fork()
    • Unit not found in scope error is no longer exists, any unit could be used in any scope
    • Increase performance of fork and serialize a hundredfold
  • Add support for attached effects to fork handlers
  • Add support for tuples to fork values and handlers: fork({values: [[$user, 'alice'], [$age, 22]]})
  • Add serialize: 'ignore' option to createStore to declare store as ignored by serialize calls
  • Make onlyChanges: true a default serialize option
  • Fix babel plugin issue with parsing method calls (e.g. in react native)
  • Validate combine arguments and throw an error in case of undefined and non-store units (issue #509)
  • Throw an error when fork handlers or values got units without sid or with duplicate sid
  • Deprecate createStoreObject alias for combine
  • Deprecate effector/fork module
  • Deprecate .thru
  • Deprecate second argument in store.map
  • Deprecate direct manipulations with derived units:
    • Deprecate .on in derived stores created by store.map and combine
    • Deprecate calls of derived events created by event.map, event.filterMap and event.filter
    • Deprecate calls of fx.done, fx.doneData and other events belongs to effects
  • Remove ɔ (latin small letter open o) symbol to prevent incorrect unicode parsing
  • Remove undocumented scope.find which is a wrong abstraction for a new fork
  • Make Scope a unit:
    • Add support for Scope to is.unit
    • Add is.scope method
  • Allow to pass a scope to scopeBind: scopeBind(unit, {scope}), which is also can be used outside from .watch
  • Improve es modules support
  • Make package size 10% smaller

effector-react 22.0.0

  • Add module effector-react/scope and make effector-react/ssr an alias for it
  • Fix Cannot update a component warning in useGate
  • Allow to return undefined in useStoreMap
  • Make domain field in createGate optional
  • Deprecate createContextComponent and createReactState
  • Improve es modules support

effector-vue 22.0.0

  • Improve es modules support

forest 0.20.0

  • Improve es modules support
Package Rankings
Top 1.08% on Npmjs.org
Top 14.96% on Deno.land
Badges
Extracted from project README
Tested with browserstack