Skip to content

Instantly share code, notes, and snippets.

View JoviDeCroock's full-sized avatar
🐨

Jovi De Croock JoviDeCroock

🐨
View GitHub Profile
import React from 'react';
import { useClient, gql } from 'urql';
const TodoQuery = gql`
query($id: ID!) {
todo(id: $id) {
id
text
}
}

10.11.0

New Hook: useId

Today we are announcing a new hook useId, this hook is meant to create stable unique identifiers that are consistent on both server-side render and client-side hydration. This feature can to enable a11y features for reusable components, ...

To enable the isomorphic unique identifiers you will need Preact-render-to-string 5.2.4 on the server.

(#3583, thanks @JoviDeCroock)

/**
* The transformer signature is based on https://github.com/cevek/ttypescript#program
*/
export default function (program) {
const checker = program.getTypeChecker();
return (context) => {
const { factory } = context;
return (sourceFile) => {
const visitor = (node) => {
import fetch from 'node-fetch'
import { getIntrospectionQuery } from 'graphql'
// TODO: you can get a token by means of using settings --> api-tokens
const token = '';
const apiUrl = 'https://api.graphcdn.io/api'
const originUrl = 'https://trygql.formidable.dev/graphql/basic-pokedex'
// The app { config { input } } can be used to write the graphcdn.YAML file with help of libs like "@atomist/yaml-updater"
async function listOrganizations() {
export class BaseClient {
connect() {} // some types
}
export class EthereumClient extends BaseClient {
connect() {
// connects with ethers
}
}
import { gql } from "@urql/core"
export type Maybe<T> = T | null;
export type InputMaybe<T> = Maybe<T>;
export type Loan_Filter = {
closed?: InputMaybe<Scalars['Boolean']>;
closed_in?: InputMaybe<Array<Scalars['Boolean']>>;
closed_not?: InputMaybe<Scalars['Boolean']>;
closed_not_in?: InputMaybe<Array<Scalars['Boolean']>>;

Introduction

Working in large groups of people who are all in different timezones can be challenging at first but it doesn't have to be. There are ways around this, some of the solutions that I have seen working in the wild quite a lot are

  • Asynchronous communication
  • Clear project goals
  • Elaborate issue templates

Communication

import { useQuery, gql } from 'urql';
import { TodoListItem, TODO_LIST_ITEM_FRAGMENT } from './TodoListItem';
export const TODO_LIST_ITEM_FRAGMENT = gql`
fragment TodoListItemProps on Todo {
text
completed
}
`;

The thing I miss in my current project for instance would be the fact that it's hard to be granular in queries, let's say we have a root that queries a set of products.

useQuery({ query: 'query { products { } }'})

We'd have to tailor the selectionSet of products for all the sub-components here. If we know we have a ProductList child, I'd love to make it look like this:

const { appendFile } = require("fs");
const fetch = require("node-fetch");
const fs = require('fs');
const params = JSON.parse(fs.readFileSync('./config.json'));
/* Example
{
"accountManager": {
"scope": "SALESFORCE_COMMERCE_API:xxxx_xxx sfcc.yy",
"clientId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",