Releases: asd-xiv/state-list
Releases · asd-xiv/state-list
v4.1.0
v4.0.0
v3.5.0
v3.4.1
v3.4.0
v3.3.0
v3.2.0
v3.1.0
v3.0.0
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
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}`),
})