Skip to content

Releases: asd-xiv/state-list

v4.1.0

31 Jan 17:51
Compare
Choose a tag to compare

4.1.0 (2020-01-31)

Features

  • Add "hasWithId" selector to check if item exists (0c5f7e8)

v4.0.0

26 Jan 21:59
Compare
Choose a tag to compare

4.0.0 (2020-01-26)

Features

  • Change buildList factory signature (b289f80)

BREAKING CHANGES

  • Moved all properties into one object.
buildList({
  name: "...",
  create: () => {},
  read: () => {},
  readOne: () => {},
  update: () => {},
  remove: () => {},
  onChange: () => {},
})

v3.5.0

25 Jan 23:37
Compare
Choose a tag to compare

3.5.0 (2020-01-25)

Bug Fixes

  • queue: Insidious bug where in a legitimate case of running the same function with the same signature multiple times it would return the promise from the first call. (a8c0242)

Features

  • Add onChange function when defining a list (14feaf2)

v3.4.1

20 Jan 21:23
Compare
Choose a tag to compare

3.4.1 (2020-01-20)

Bug Fixes

  • .clear not emptying items array (5b91e7e)

v3.4.0

16 Jan 23:09
Compare
Choose a tag to compare

3.4.0 (2020-01-16)

Features

  • If .readOne result does not exist in .items array, add it (1694f3c)
  • Spread all non primitive selector results (495088e)

v3.3.0

28 Dec 00:25
Compare
Choose a tag to compare

3.3.0 (2019-12-28)

Features

v3.2.0

26 Nov 23:51
Compare
Choose a tag to compare

3.2.0 (2019-11-26)

Features

  • Add .read "shouldClear" option. Either replace or merge results. (daae607)

v3.1.0

12 Nov 21:56
Compare
Choose a tag to compare

3.1.0 (2019-11-12)

Features

  • Update remove action to acception isLocal option (rename isDraft option -> isLocal) (23d5a07)

v3.0.0

02 Oct 16:59
Compare
Choose a tag to compare

3.0.0 (2019-10-02)

Bug Fixes

  • "read" method return the same structure as other methods (c0260fc)

Features

  • Add useList hook and remove old list selector (80c489a)
  • Add new "readOne" method to expand/load more information on a item (af2b780)
  • Rename "delete" list method to "remove" (39ff862)

BREAKING CHANGES

  • List.selector is no longer available. Use new hook to interact with
    state and actions.
// define list
const todos = buildList("TODOS", {
  read: () => {}
})

// New
// Access all available actions and selector
const {
  selector, create, read, readOne, update, delete, clear
} = useList(todos, store.dispatch)

// New
// All previous selector are available throught the new hook
const { items, isLoaded } = selector(store.getState())
  • All methoods have the same return format. An object with result and
    error keys.
// old
const items = await list.read()

// new
const { result } = await list.read()
  • When defining a list, use "remove" instead of "delete".
const todos = buildList("READ_TODOS", {
  create: () => ...
  read: () => ...
  // delete: () => ...
  remove: () => ...
})

v2.0.0

15 Sep 22:55
Compare
Choose a tag to compare

2.0.0 (2019-09-15)

Features

  • Change factory function signature (1560c7a)

BREAKING CHANGES

// old
buildList({
 name: "PAGE__SECTION--TODOS",
 methods: {
   create: data => POST("/todos", data),
   read: () => [{id: 1, title: "lorem ipsum"}],
   update: (id, data) => PATCH(`/todos/${id}`, date),
   delete: id => DELETE(`/todos/${id}`),
 }
})

// new
buildList("PAGE__SECTION--TODOS", {
 create: data => POST("/todos", data),
 read: () => [{id: 1, title: "lorem ipsum"}],
 update: (id, data) => PATCH(`/todos/${id}`, date),
 delete: id => DELETE(`/todos/${id}`),
})