Skip to content

Connect ResourceList to Redux#23

Merged
simba-git merged 14 commits intodevelopfrom
feature/simba/resourceListls
Jul 31, 2020
Merged

Connect ResourceList to Redux#23
simba-git merged 14 commits intodevelopfrom
feature/simba/resourceListls

Conversation

@simba-git
Copy link

No description provided.

Simba added 14 commits July 29, 2020 15:46
We use Object.freeze to create an enum. The EnumItem returned via
the Enum package wasn't serializable by Redux and was awkward to use.
A javascript object is easier to use.
ResourceListView used to only handle title, now it handles data and
loading. It takes in failed, but does nothing with it currently.
ResourceList.js was moved and expanded to only handle logic relevent to
the view layer.
resourceTypes will be used across different components and lives better
tied with the API rather than a single component.
The NavSlice data will be extended to include view types. It would be
strange for this information to be hardcoded in the Nav rather than
the higher level App.
Currently fetchResources just returns a resolved Promise and is
essentially a mock. I could have mocked it in App.js but decided to put
it in the API to connect everything correctly.
The NavSection was extended to include its own view information. This
allows for the views to be dynamic.

Currently we have two views, Empty which is jsut an empty Box and ResourceList.
The ResourceAPI is passed into every version, though that should be changed.
This allows it to be added to the rootReducer in reducers/. It's
already in there but would fail because App wasn't exporting.
ResourceSlice was using the old resourceTypes before it was moved.

* this commit also does a very small line swap for cleaner formatting
ResourceList connects the ResourceSlice with the ResourceListView.

Since we use Nav to handle making a component active, we use the
factory method version of binding props and dispatch.

This also changes index.js slightly to make ResourceList the default
export rather than ResourceListView
In the NavSections, if view is not set, we set it to empty by default.
We don't need it to be draggable, and it simplifies things to make it
not draggable. I was unable to get mount() to work either when having
draggable enabled, and didn't make much progress on solving.
Prior to this, all props were being passed from ResourceList to
ResourceListView. Passing only the required props makes things easier
to test and leaves less room for error in the view.
We mount the ResourceList in a ReduxWrapper to connect a test store
to it. We then make sure that fetch is called onComponentMount and
that the props are being connected properly and passed down to
ResourceListView.
@simba-git simba-git merged commit 54b3698 into develop Jul 31, 2020
@simba-git simba-git deleted the feature/simba/resourceListls branch July 31, 2020 00:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant