Skip to content

Instantly share code, notes, and snippets.

Avatar

Antoine LIN toinelin

View GitHub Profile
@toinelin
toinelin / client-query.tsx
Last active March 18, 2022 04:54
GraphQL Urql client with multiple GraphQL endpoints
View client-query.tsx
function getDataFromEndpointA() {
const { data } = await client.query(myQueryForEndpointA, {}, {
clientName: 'endpoint-a',
}).toPromise()
return data
}
function getDataFromEndpointB() {
const { data } = await client.query(myQueryForEndpointB, {}, {
@toinelin
toinelin / client.ts
Last active June 16, 2020 09:00
Use Urql with Prismic CMS
View client.ts
import {
createClient,
Exchange,
Operation,
dedupExchange,
fetchExchange,
} from 'urql'
import { cacheExchange } from '@urql/exchange-graphcache'
import Prismic from 'prismic-javascript'
import { pipe, mergeMap, fromPromise, map } from 'wonka'
@toinelin
toinelin / algo.md
Created August 27, 2018 13:38
Algo
View algo.md

Auto filter by product

Objectif

  • Filtrer le tableau des produits par les attributs sélectionnés ⇒ quand je choisis un attributs je veux filtrer tout les produits par le dit attribut
  • Modifier les champs attributs pour retirer ceux qui ne correspondent pas aux attributs déjà sélectionnés ⇒ quand je filtre la liste des produits, je veux que les champs se filtrent : les attributs qui ne partage pas une correspondance entre eux doivent disparaitre
  • Afficher tout les attributs d'un champs qui partagent le filtrage des autres champs ⇒ quand je choisis un attribut du champs brand_name (par exemple) je veux que seul les attributs du champ brand_name qui ne possèdent pas de correspondance avec les autres attributs sélectionnés disparaissent : je veux pouvoir garder la possibilité de choisir un attribut brand_name qui partage les attributs sélectionnés pour augmenter mon scope range

Algorithme