GithubHelp home page GithubHelp logo

Comments (5)

orther avatar orther commented on May 26, 2024

It looks like none of this extra madness would be necessary if I just fully implemented the ResourceLoader component as detailed in #19 In the issue it's explained that if the resource was normalized by setting the entityType prop then the results passed to child render prop is the entities rather than the resource(s) and so it would be default be based on state.

My current plan is to update ResourceLoader to return raw resource response data, entities data, and then update the result prop to hold either response data or entities data based on whether the resource was normalized by setting a entityType prop value.

from uptrend-redux-modules.

orther avatar orther commented on May 26, 2024

Actually it would make more sense to match the resourceHelpers selectors as described in #17 and follow this conventions:

  // returned data
  resource, // <- resource data (when normalized returns entity id(s))
  result,   // <- if the resource was normalized into entities this
            //    holds the list of entities, otherwise returns the
            //    resource data (non-normalized)

With that said, we should provide access to the raw API response data too for features like pagination. So we may want to add another prop that holds extraneous values. Will consider...

from uptrend-redux-modules.

orther avatar orther commented on May 26, 2024

Current thinking is added a requestResult prop that has the following data from the resource request success action payload:

const requestResult = {
      api: payload.api,
      data: payload.data,
      entities: payload.entities,
      entityType: payload.entityType,
      resource: payload.resource,
    }

from uptrend-redux-modules.

orther avatar orther commented on May 26, 2024

Final thoughts before stopping for the night....

By providing the requestResult object as outlined above I was nicely able to use EntityList component to load the entities from state. By doing so updates to state reflect in the rendered list.

        {status.success &&
          locationList &&
          entities &&
          <EntityList entityIds={entities} entityType="planAppLocation">
            {locationList => {
              console.log('locationList', locationList);
              return (
                <OrgPlanAppLocationOverviewPage
                  orgId={orgId}
                  planAppId={planAppId}
                  locationList={locationList}
                />
              );
            }}
          </EntityList>}

I created a branch with EntityList and EntityDetail created inside the ResourceLoader component but I feel like that is the wrong solution. Instead a separate component should be made that simply joins the two. Branch here: https://github.com/uptrend-tech/uptrend-redux-modules/tree/resource-loader-include-entities-experimental

from uptrend-redux-modules.

orther avatar orther commented on May 26, 2024

Closing since we are using the EntityDetail and EntityList components to solve this for now. Still not sure what the best path forward is to remove even more boilerplate.

from uptrend-redux-modules.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.