- Fragment is the building block of the relay
- Fragment is a selection of fields on a GraphQL Type
- Fragment allow you to colocate data
- Relay composes fragments from multiple components into optimized and efficient batches to reduce round-trips to the server
- Its hard to over-fetch and under-fetch
- Components can only access data they've asked for - data mask - each one must declare its own data requirements without relying on others
- Components only re-render when the exact data they're using is updated, preventing unnecessary re-renders
- In short, colocating data make your components modular, easier to refactor, more performant and less error-prone
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
import { NotificationSentModel } from '@entities'; | |
import { GraphQLID, GraphQLNonNull } from 'graphql'; | |
// import { subscriptionWithClientId } from 'graphql-relay-subscription'; | |
import { withFilter } from 'graphql-subscriptions'; | |
import { fromGlobalToId, subscriptionObjectType } from './utils'; | |
import pubSub, { EVENTS } from '../../../pubSub'; | |
import NotificationSentType from '../NotificationSentType'; | |
const subscriptionAsyncIterator = () => pubSub.asyncIterator(EVENTS.NOTIFICATION.SENT); |
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
/** | |
* Modify the parts you need to get it working. | |
*/ | |
var should = require('should'); | |
var request = require('../node_modules/request'); | |
var io = require('socket.io-client'); | |
var serverUrl = 'http://localhost'; |
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
server { | |
listen 80; | |
listen [::]:80; | |
server_name graphql.mydomain.com.br; | |
location / { | |
proxy_pass http://mydomain:8080; | |
} | |
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
module.exports = { | |
presets: [ | |
'@babel/preset-react', | |
[ | |
'@babel/preset-env', | |
{ | |
targets: { | |
node: 'current', | |
}, | |
}, |
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
const base64ToPDF = (base64) => { | |
const byteString = window.atob(base64); | |
const arrayBuffer = new ArrayBuffer(byteString.length); | |
const int8Array = new Uint8Array(arrayBuffer); | |
for (let i = 0; i < byteString.length; i += 1) { | |
int8Array[i] = byteString.charCodeAt(i); | |
} | |
const blob = new Blob([int8Array], { type: 'application/pdf' }); | |
const pdfURL = URL.createObjectURL(blob); |
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
import React from 'react'; | |
import { useFormik } from 'formik'; | |
import * as Yup from 'yup'; | |
import Button from '@material-ui/core/Button'; | |
import TextField from '@material-ui/core/TextField'; | |
import EditorField from './EditorField'; | |
type InitialValuesFormikType = { | |
editor: string; |
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
https://www.sitehosting.com.br/streaming-de-video-ao-vivo/ | |
https://www.mediastream.com.br/ | |
https://colorwhistle.com/live-stream-video-on-website/ | |
https://habr.com/ru/post/453374/ | |
https://www.twilio.com/voice/conference | |
https://whereby.com/ |
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
import React, { useRef, useState } from 'react'; | |
import { Typography } from '@material-ui/core'; | |
import TextField from '@material-ui/core/TextField'; | |
import CircularProgress from '@material-ui/core/CircularProgress'; | |
import Autocomplete, { | |
AutocompleteChangeDetails, | |
AutocompleteChangeReason, | |
AutocompleteProps | |
} from '@material-ui/lab/Autocomplete'; |
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
const path = require('path'); | |
const webpack = require('webpack'); | |
const WebpackNodeExternals = require('webpack-node-externals'); | |
const ReloadServerPlugin = require('reload-server-webpack-plugin'); | |
const cwd = process.cwd(); | |
module.exports = { |