Skip to content

Releases: ekosz/redux-falcor

v3.0.0

04 Jan 21:35
Compare
Choose a tag to compare

[BREAKING] Version 3.0

About a month ago I realized that in its current state, redux-falcor would never be super useful. Whenever I had an action that would need to invalidate the falcor cache, I needed to reload the page to clear the falcor and redux states. In versions 2.x there was not a good way to patch removals into the redux state from falcor. Not to mention the system did not play well with falcor's internal LRU garbage collection.

After talking with @trxcllnt last month I realized the only way to make the library truly useful would be to replace the redux state with the falcor state each time its changed instead of just patching the changes. That would require redoing the library from scratch. And so I did. This new version of redux-falcor is completely rewritten from scratch. The API is 100% different and requires all users of the library to rewrite their code to use the new code. I realize this may be a huge pain for many, and it definitely cost me 2 entire days of work rewriting my own code. But after using version 3.0 in production for about 2 weeks now I know it was the correct decision. The interactions between falcor and redux are almost seamless now and no more needing to reload the page.

Without further ado, the new API (which at least is much smaller).

Breaking

Everything.

Additions

<FalcorProvider store falcor> - A top level Component that allows the reduxFaclor method to connect Components to the redux-falcor store.
reducer(state, action) - The new name of the reducer. This needs to be including in the redux store to work have falcor state persisted in redux.
reduxFalcor(Component) - Acts like react-redux's connect. Connects a component to the overall redux-falcor context.

For more info on the API and a quick example please take a look at the rewritten README.

v2.3.3

16 Nov 21:01
Compare
Choose a tag to compare

Fix: Don't set state.loading false prematurely

Before this fix if there were two parallel falcor requests, and one finished before the other, the redux loading state would be set to false even while the second request is still happening.

After this change redux-falcor now keeps track of each active request and only sets loading to false when there are none left.

v2.3.1

01 Nov 16:26
Compare
Choose a tag to compare

This release fixes some spelling mistakes I had littered about the code base. I had a hard time deciding whether or not to make this a major version change, but I don't think most people will need to change any code after this release.

Fixed spelling of "falcor" in action constants - Thanks @jmandzik !

This was a silly typo where the word "falcor" was spelled as "faclor" in the action constant strings. As long as you are using the constant itself, and not the misspelled string, you will not need to change any code.

Fixed spelling of "UnrecognizedActionTypeException" - Thanks @maxmechanic !

Again, a bad typo. The exception was spelled as "UnreconizedActionTypeException". This error is only used internally to the library so you should not need to change any code here either.

Thank you everyone for catching my dumb mistakes!

v2.3.0

24 Oct 01:41
Compare
Choose a tag to compare

This release adds one new action

clear

The clear action can be dispatched to clear out all of the falcor state from the redux store. This is useful for events like logout.

import { clear } from 'redux-falcor';

// Data in store
store.dispatch(clear())
// Data is not in store

Unlike other actions, this action does not return a promise. Also to note, this action currently does not touch the falcor cache, only the redux store.

v2.2.0

22 Oct 22:25
Compare
Choose a tag to compare

This release adds one new action and reverts changes made in v2.1.0:

setPaths

When one wants to set multiple values at the same time, setPaths is the way to do it.

Simple Example

store.dispatch(setPaths(
  { path: 'my.email', value: '[email protected]' },
  { path: 'my.name', value: 'John Smith' },
));

Complex Example

const prefix = ['my'];
const data = {
  email: '[email protected]',
  name: 'John Smith',
};
const pathValues = Object.keys(data).map(field => {
  return { path: prefix.concat(field), value: data[field] };
});

store.dispatch(
  setPaths.apply(this, pathValues)
);

This release also reverts all of the changes in v2.1.0. I misread the documentation and had it all wrong. I'm really sorry about that.

Version 2.0.0

21 Oct 20:05
Compare
Choose a tag to compare

This release has a couple breaking changes:

falcor.loading

The loading attribute is now set on the falcor state. This can be useful for deciding whether a value is missing of just hasn't been loaded by falcor yet.

function mapStateToProps(state) {
  return {
    loading: state.falcor.loading,
    data: state.falcor.data,
  };
}

If your falcor endpoint is already setting the loading attribute this will have conflicts with you

Renamed action types

Before this release the name of the action type constants looked something like "FACLOR_SET_PATH". They have all been updated to follow redux standards and now look like "redux-falcor/falcor/SET_PATH".

If you were hard coding the name of the action types in your code, please use the next section when updating.

Exposed action type constants

All of the action type constants are now exposed by the library. That means it's much easier to write your own reducers on redux-falcor actions.

import { RETRIEVE_VALUE } from 'redux-falcor';

function userReducer(state, action) {
  if (action.type === RETRIEVE_VALUE && action.path == ['my', 'name']) {
    return {...state, name: action.res};
  }

  return state;
}

If you were hard coding your reducers before, please use the new exposed constants

Version 1.2.1

14 Oct 18:45
Compare
Choose a tag to compare

This fixes a bug where the documentation was lying. Currently the documentation in the README has this example:

store.dispatch(retrieveValue('usersById[35]["email"]').then((email) => {
  console.log(email); // [email protected]
});

But before this that wouldn't work as the value of email was the boolean true. Now we return the result of the falcor promise.

Version 1.2.0

13 Oct 21:46
Compare
Choose a tag to compare

This release adds one new action:

callPath

Not every action can be expressed as an idempotent get or set operation. For those actions we need to take that are mutations we need to call remote functions. You can read more at the falcor docs here.

store.dispatch(
  callPath('invites.send', '[email protected]', [['status','email']],[['length']])
);

Up next is implementing setValue.

Version 1.1.0

08 Oct 18:30
Compare
Choose a tag to compare

This release adds two new actions:

retrievePaths

If you need to get multiple paths from falcor at the same time you can now dispatch the retrievePaths action.

store.dispatch(retrievePaths('my["email"]', 'my["users"][0..3]["name"]'));

setPath

When you want to set a set path you can dispatch the setPath action.

store.dispatch(setPath('my["email"]', '[email protected]'));

Up next is implementing setValue and callPath.

Version 1.0.0

06 Oct 14:54
Compare
Choose a tag to compare

First public release.