Poisonal
Pass it along a thing worth keeping

Studio Owners Defend $2,500 Bike Lane Veto as 'Standard Industry Networking'

In exchange for Zelle payment and TV cameo, city aide agreed to ignore safety advocates' pleas, keeping McGuinness Boulevard lethal for another decade.

10 months ago β€’ 8 min read
Text Size
⚑
Speed Reading
Press Tab
πŸ”‡
Read Aloud
Press A

Entertainment Labor Union Rep

Entertainment Labor Union Rep

Reading...
SPEED READING
Complete!
1 / 0
500 WPM
Text Size
⚑
Speed Reading
Press Tab
πŸ”‡
Read Aloud
Press A

why he refuses to migrate the legacy codebase

why he refuses to migrate the legacy codebase

Reading...
SPEED READING
Complete!
1 / 0
500 WPM
Text Size
⚑
Speed Reading
Press Tab
πŸ”‡
Read Aloud
Press A

Migrate Your Legacy PHP Logic to Java Services

Migrate Your Legacy PHP Logic to Java Services

Reading...
SPEED READING
Complete!
1 / 0
500 WPM
Text Size
⚑
Speed Reading
Press Tab
πŸ”‡
Read Aloud
Press A

The Server-Side Monopoly: PHP and Java Fight for the World Wide Web

The Server-Side Monopoly: PHP and Java Fight for the World Wide Web

Reading...
SPEED READING
Complete!
1 / 0
500 WPM
Image

0 Β·
No messages yet.
Text Size
⚑
Speed Reading
Press Tab
πŸ”‡
Read Aloud
Press A

First-time Founder

First-time Founder

Reading...
SPEED READING
Complete!
1 / 0
500 WPM
Text Size
⚑
Speed Reading
Press Tab
πŸ”‡
Read Aloud
Press A

useEffect Dependency Arrays

useEffect Dependency Arrays

Reading...
SPEED READING
Complete!
1 / 0
500 WPM

Before useMemo / After useMemo

typescript

+5-2
1 1
import { useQuery } from '@apollo/client';
2
+import { useMemo } from 'react';
2 3
import { GET_USER } from './queries';
3 4
4 5
export default function UserProfile({ userId }) {
@4 unchanged lines
9 10
if (loading) return <div>Loading...</div>;
10 11
11 12
const user = data.user;
12
- const formattedName = user.firstName + ' ' + user.lastName;
13
- const userObject = { name: formattedName, email: user.email };
13
+ const userObject = useMemo(() => ({
14
+ name: user.firstName + ' ' + user.lastName,
15
+ email: user.email
16
+ }), [user.firstName, user.lastName, user.email]);
14 17
15 18
return (
16 19
<div>
@5 unchanged lines
Text Size
⚑
Speed Reading
Press Tab
πŸ”‡
Read Aloud
Press A

The Triple-Declaration Problem

The Triple-Declaration Problem

Reading...
SPEED READING
Complete!
1 / 0
500 WPM
Text Size
⚑
Speed Reading
Press Tab
πŸ”‡
Read Aloud
Press A

Find the Real Culprit in node_modules

Find the Real Culprit in node_modules

Reading...
SPEED READING
Complete!
1 / 0
500 WPM
Text Size
⚑
Speed Reading
Press Tab
πŸ”‡
Read Aloud
Press A

Server Component Type Contracts

Server Component Type Contracts

Reading...
SPEED READING
Complete!
1 / 0
500 WPM

The Mapping Loop, Documented

typescript

+12-10
1
-// Before: Loose GraphQL query without type safety
2
-const query = `
1
+// After: Type-safe GraphQL with Next.js server components and TypeScript
2
+import { graphql } from 'gql.tada';
3
+
4
+const GetUserQuery = graphql(`
3 5
query GetUser($id: ID!) {
4 6
user(id: $id) {
5 7
id
@1 unchanged line
7 9
email
8 10
}
9 11
}
10
-`;
11
-
12
-const result = await fetch('/api/graphql', {
13
- method: 'POST',
14
- body: JSON.stringify({ query, variables: { id: '123' } })
15
-});
12
+`);
16 13
17
-const data = result.json();
18
-console.log(data.user.name); // No guarantee this exists
14
+export default async function UserProfile({ userId }: { userId: string }) {
15
+ const result = await executeQuery(GetUserQuery, { id: userId });
16
+
17
+ // TypeScript enforces that result.user.name exists
18
+ // Any typo in field names fails at build time ((cite:A1-F2))
19
+ return <div>{result.user.name}</div>;
20
+}
Text Size
⚑
Speed Reading
Press Tab
πŸ”‡
Read Aloud
Press A

Why Your Types Are Never in the Same Room

Why Your Types Are Never in the Same Room

Reading...
SPEED READING
Complete!
1 / 0
500 WPM
Cycle

The Type Duplication Loop

01
πŸ“
Define GraphQL Schema
Write your GraphQL schema in your Next.js codebase. This serves as API documentation that lives alongside your code.
02
βš™οΈ
Generate TypeScript Types
Run a code generator (like GraphQL Code Generator) to extract TypeScript types from your schema, creating type definitions for your queries and mutations.
03
πŸ”Œ
Write Resolvers & API Routes
Implement your GraphQL resolvers or Next.js API routes using the generated types. This is where manual type mapping consumes the majority of your build time, forcing you to manually reconcile schema definitions with resolver implementations.
04
🎯
Execute Queries in Components
Use the generated types in your client code or Next.js server components eliminate the need for a separate GraphQL client for roughly half of typical query work.
05
🚨
Handle Type Mismatches
TypeScript catches every minor typo during compilation instead of letting mismatches slip into runtime. Fix the type errors, then loop back to step 3.
06
πŸ”„
Regenerate on Schema Change
When you update your GraphQL schema, regenerate types and manually reconcile all affected resolver implementations. The cycle repeats.

More from Greenpoint