outlandishideas/kasia

Support comma-separated (?) dot-paths for `shouldUpdate`

Closed this issue · 1 comments

A connectWpQuery's shouldUpdate function tends to look something like this:

const shouldUpdate = (thisProps, nextProps) => {
  return thisProps.location.query.page !== nextProps.location.query.page
}

It would be nice if shouldUpdate could also be a string of dot-paths that inform Kasia to check that path for strict equality on both this and next props. For example, the following being equivalent to the above:

@connectWpQuery(query, 'location.query.page')

Multiple paths could be separated by commas (and spaces too?):

// comma separated
@connectWpQuery(query, 'location.query.page,params.topic')

// space separated
@connectWpQuery(query, 'location.query.page params.topic')

Implemented in v4.2 beta.