Skip to content

REFACTOR: Staged loading

dju requested to merge stagedLoading into master

Feature Merge Request

Related Issue

closes #216 (closed) and prepares the stage for #219 (closed)

Description of Feature

This implements staged loading:

  • Components define what they need loaded by passing the respective function to the load-property of the hoc-loadingComponent (e.g. AssessmentData, AssessorList, Meetingpoint,...)
    • FilterView.js is an exception i.e. it always displays. I found that it looked cool when the assessments came in one-by-one (if there are many)
    • this required saving the address of the assessment in the assessmentView into state, as calling a function via the hoc does not allow passing it as argument from the url-bar.
  • Loading (fetching) data from chain also sets a flag in a new reducer, the laodingReducer. the respective components will then render a loading-text until the fetching is finished.
    • the actions & state of the loading reducer should be moved into the respective reducers in another refactor. for now i kept it separate to allow for simpler case-handling. Another thing to consider will be how to save the last block we need to go back to when we save assessments in state. Until that is figured out, I think it is easier to develop with a separate loading-reducer.
  • basic assessment-info (cost, size, assesse,...) is now only fetched once. Afterwards only the stage is updated. That same logical flow that will be used when we listen to events (updateAssessments() -> updateExistingAssessment())
  • There is a new AppContainer component that waits for web3 to be there and then renders the rest
  • separate folders for all connected components

Motivation and Context

fetching all data from the header is not logical. Data should only be fetched if not already there. If something is revisited, we should only fetch the data that can change. especially if users navigate to the assessment individal view, e.g. after having been shared a link to an assessmnet. THen all they might be interested in is the specific assessment

notes

to see the staged loading in effect, comment in the console.log in the loadingReducer-actions LOAD/END_ASSESSMENT_DETAIL

Related Tasks

Once transaction-handling is there, we can then make the confirmation of the stake/commit/reveal-transaction retrigger the fetching of the assessorData. That way the view will be automatically be up2date


Edited by dju

Merge request reports