Skip to content

[$50] Skills drop-downs should load all the pages from Skills API once for all component instances #4213

@maxceem

Description

@maxceem
  1. Load all skills

  2. At the moment we are showing several instances of the skills questions, and each of them is loading skills for itself:

    image

    • As now we would have to load several pages, there would be even more requests.

    • So we have to load skills only once for all the instances.

    • There is some caching is implemented, but it doesn't work when we are showing all the components at the same time. So we have to fix it. The fix could be to create a function which would return a promise and that promise would return skills loaded or cached:

      // so the idea of code can be like this
      
      function getSkills() {
         if (!getSkills.cachedPromise) {
            getSkills.cachedPromise = new Promise(resolve, reject) {
                // load all skills pages
                resolve(skills);
                // reject(error) if error
            }
         }
      
         return getSkills.cachedPromise;
      }
      
      // inside component 
      componentWillMount() {
          getSkills().then((skills) => { setOptions(....) }).catch(() => {...})
      }

See the Skills Dropdown components by following this link https://connect.topcoder-dev.com/new-project/talent-as-a-service.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions