Skip to content

Instantly share code, notes, and snippets.

View alloy's full-sized avatar

Eloy Durán alloy

View GitHub Profile

So here's (part of) the problem:

  • When you use require in Node, Node will look at the closest node_modules and if it can’t find it there look in the parent dir for a node_modules install that has it, until it reaches /.

  • When you ‘link’ npm/yarn do nothing else but create a symlink in your node_modules to the package that presumable lives outside of the tree your app lives in (eg it’s a sibling).

  • Now when your linked package tries to require something and it can’t find it in its own node_modules where should it look? The (real) parent dir isn’t the app, but that’s the default behaviour anyways, so it will fail

  • “But how could that package not be in the linked package’s node_modules?!” you ask, which is a very valid question.

@alloy
alloy / graphql+0.13.2.patch
Last active April 20, 2019 16:34
relay-compiler v3 clickable error messages
patch-package
--- a/node_modules/graphql/error/printError.js
+++ b/node_modules/graphql/error/printError.js
@@ -53,7 +53,7 @@ function highlightSourceAtLocation(source, location) {
var padLen = nextLineNum.length;
var lines = source.body.split(/\r\n|[\n\r]/g);
lines[0] = whitespace(source.locationOffset.column - 1) + lines[0];
- var outputLines = [source.name + ' (' + contextLine + ':' + contextColumn + ')', line >= 2 && lpad(padLen, prevLineNum) + ': ' + lines[line - 2], lpad(padLen, lineNum) + ': ' + lines[line - 1], whitespace(2 + padLen + contextColumn - 1) + '^', line < lines.length && lpad(padLen, nextLineNum) + ': ' + lines[line]];
+ var outputLines = [source.name + ':' + contextLine + ':' + contextColumn, line >= 2 && lpad(padLen, prevLineNum) + ': ' + lines[line - 2], lpad(padLen, lineNum) + ': ' + lines[line - 1], whitespace(2 + padLen + contextColumn - 1) + '^', line < lines.length && lpad(padLen, nextLineNum) + ': ' + lines[line]];
return outputLines.filter(Boolean).join('\n');
{
"type": "many-events",
"events": [{
"type": "event",
"evt": "update",
"data": {
"nodeType": "Native",
"key": null,
"ref": null,
"source": {
<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Type Emission · Relay</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="&lt;p&gt;As part of its normal work, &lt;code&gt;relay-compiler&lt;/code&gt; will emit type information for your language of choice that helps you write type-safe application code. These types are included in the artifacts that &lt;code&gt;relay-compiler&lt;/code&gt; generates to describe your operations and fragments.&lt;/p&gt;
"/><meta name="docsearch:version" content="next"/><meta name="docsearch:language" content="en"/><meta property="og:title" content="Type Emission · Relay"/><meta property="og:type" content="website"/><meta property="og:url" content="https://facebook.github.io/relay/index.html"/><meta property="og:description" content="&lt;p&gt;As part of its normal work, &lt;code&gt;relay-compiler&lt;/code&gt; will emit type
commit 519e45328200a0a23b37245bbe198f9d834407bf
Author: Eloy Durán <eloy.de.enige@gmail.com>
Date: Fri Dec 7 00:52:07 2018 +0100
stash more
diff --git a/src/DevTools/createMockNetworkLayer/__tests__/createMockNetworkLayer.test.ts b/src/DevTools/createMockNetworkLayer/__tests__/createMockNetworkLayer.test.ts
index c82aeb5c..7f548964 100644
--- a/src/DevTools/createMockNetworkLayer/__tests__/createMockNetworkLayer.test.ts
+++ b/src/DevTools/createMockNetworkLayer/__tests__/createMockNetworkLayer.test.ts
diff --git a/src/Apps/Artwork/Components/ArtworkBanner/index.tsx b/src/Apps/Artwork/Components/ArtworkBanner/index.tsx
index c98ee685..42f7ff55 100644
--- a/src/Apps/Artwork/Components/ArtworkBanner/index.tsx
+++ b/src/Apps/Artwork/Components/ArtworkBanner/index.tsx
@@ -13,7 +13,15 @@ export interface ArtworkBannerProps {
}
export const ArtworkBanner: React.SFC<ArtworkBannerProps> = props => {
- const { context, partner } = props.artwork
+ const { auctionContext, fairContext, showContext, partner } = props.artwork

Media React component

TODO: Describe problem and ideally how to avoid using the Media component altogether

  • declerative rather than imperative

API

Setup

diff --git a/src/Apps/Order/Routes/Shipping/index.tsx b/src/Apps/Order/Routes/Shipping/index.tsx
index 1567b825..b8e8d139 100644
--- a/src/Apps/Order/Routes/Shipping/index.tsx
+++ b/src/Apps/Order/Routes/Shipping/index.tsx
@@ -109,21 +109,7 @@ export class ShippingRoute extends Component<ShippingProps, ShippingState> {
... on OrderWithMutationSuccess {
__typename
order {
- id
- state
diff --git a/src/Container.tsx b/src/Container.tsx
index f1e9310..6cd5815 100644
--- a/src/Container.tsx
+++ b/src/Container.tsx
@@ -9,7 +9,7 @@ const query = graphql`
...FragmentOne_foo
},
bar {
- ...FragmentTwo_bar
+ ...FragmentOne_bar
diff --git a/src/Apps/Order/Components/ShippingAndPaymentReview.tsx b/src/Apps/Order/Components/ShippingAndPaymentReview.tsx
index d3a8530b..a0a0c5af 100644
--- a/src/Apps/Order/Components/ShippingAndPaymentReview.tsx
+++ b/src/Apps/Order/Components/ShippingAndPaymentReview.tsx
@@ -22,7 +22,11 @@ export const ShippingAndPaymentReview = ({
onChangeShipping(): void
} & FlexProps) => (
<Flex flexDirection="column" {...others}>
- {__typename === "Pickup" ? (
+ {__typename === "Ship" ? (