This repository has been archived by the owner on Mar 5, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
ui: dynamically display lists of entities #167
Open
aspiers
wants to merge
21
commits into
HackBrexit:master
Choose a base branch
from
aspiers:entity-list
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
To correctly support both thunk middleware and Redux Devtools, we use the convenient redux-devtools-extension library to compose thunk with the middleware enhancer, and then use that as the final argument to createStore().
This will allow us to see lists of people, organisations, and government offices, and eventually click on each one to examine it.
We'll use this for asynchronous fetching of data from the Rails API into the Redux store.
This lets us group request-related functions together.
This dispatches the FETCH_ENTITIES action whose payload is an axios request object. redux-promise-middleware will handle this by executing the request's promise, and then magically dispatching FETCH_ENTITIES_{PENDING,FULFILLED,REJECTED} actions according to the 3 possible stages of the conversation with the API endpoint. Currently these 3 actions are not handled by any reducer; that will come in subsequent commits.
This will fail if for some reason targetType is missing.
I forgot to rename them when renaming the component in 9ba199a.
Also make the previously existing reducer for the ADD_ENTITY action use the same new tree structure in the store, and fix bugs where parts of the state tree were not immutable.
This provides the entity data to the container. It isn't used yet - that will be handled in the next commit.
Display the entity data provided by the store, as a simple list of entities, sorted lexically case-insensitive.
In the old ADD_ENTITY action used by ChartTitle, we had some nice validation for the action's entity type. Extend this to all actions which specify an entity type (which is currently all 4 in dataReducer), by unifying the actions' structures so that entityType is always under action.meta.
This seems to be some strange race condition where state.data is not always initialized by the time mapStateToProps is invoked, causing an exception when attempting to call getIn() on it. Maybe it only happens when auto-reloading the app whilst a git rebase is running, but I'm not really sure. Either way, we should watch out for this by logging a warning.
This can be reused by EntityList.
This was broken by the restructuring of the state tree when introducing combineReducers via 22cdf44 in HackBrexit#159.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is the final part of the work on #143. It's based on top of #162, but since that hasn't been merged yet, and GitHub is too dumb to allow PRs that depend on other PRs, this PR also contains the commits from #162. (Once #162 is merged, I can rebase to fix that.)
Issues to close
Fixes #143.
Notes
Quite a lot of code cleanup included here. Still need to introduce selectors to fix the horrible performance.