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
require('font-awesome/css/font-awesome.css'); | |
document.body.innerHTML = '<i class="fa fa-fw fa-question"></i>'; |
Simple implementation of debounced fetching in GraphQL to allow merging of multiple rest / database requests into one. Although this example uses GraphQL, the debouncedFetch
/ fetchProgramPlaycount
implementations could probably be used in any context to achieve the same result.
This approach was first described by @leebyron at graphql/graphql-js#19 (comment)
For example this allows turning ten requests for playcounts from this GraphQL query into just one:
{
latestPrograms(first: 10) {
name,
playcount