This file contains hidden or 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 "server-only"; | |
import ToDoItem from "../../components/todo/ToDoItem"; | |
import ToDoItemClient from "../../components/todo/ToDoItemClient"; | |
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms)); | |
export default async function ToDoList() { | |
const url = "http://localhost:4000/todos"; | |
const res = await fetch(url,{ |
This file contains hidden or 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
"use client"; | |
import React, { ReactNode } from "react"; | |
import { ErrorBoundary } from "react-error-boundary"; | |
export default function ErrorBoundaryFunctionalWrapper({ | |
children, | |
errorComponent, | |
}: { | |
children: ReactNode; |
This file contains hidden or 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 { useEffect, useState } from "react"; | |
const CHARS = new Set(" abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"); | |
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms)); | |
function isAlphanumeric(char) { | |
return CHARS.has(char); | |
} |
This file contains hidden or 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
.large-description { | |
color: red; | |
font-size: 20px; | |
} | |
.description { | |
color: blue; | |
fo |
This file contains hidden or 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 SpeakersHeader from "@/app/presenter/[year]/SpeakersHeader"; | |
import SpeakerContent from "@/app/presenter/[year]/[presenterSlug]/SpeakerContent"; | |
import { getDataFromGql } from "@/lib/getDataFromGql"; | |
import { initializeApollo } from "@/lib/apolloClient"; | |
import { speakerQuerySp1, speakerSlugsQuery } from "@/gql/speakers/speakers"; | |
import { Speaker, SpeakerSlug } from "@/app/common/CodeCampInterfaces"; | |
import SpeakerHeader from "@/app/presenter/[year]/[presenterSlug]/SpeakerHeader"; |
This file contains hidden or 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 {DocumentNode} from "@apollo/client"; | |
import {print} from "graphql/language/printer"; | |
export async function getDataFromGql(gqlData: DocumentNode, variables: any = undefined) { | |
const data = await fetch("https://graphql.svcc.mobi/graphql", { | |
method: "POST", | |
headers: { | |
"Content-Type": "application/json", | |
}, |
This file contains hidden or 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 "./App.css"; | |
import { useState, useDeferredValue, memo, useEffect } from "react"; | |
import { fetchCities } from "./data/cities"; | |
const displayCount = 1000; | |
// code similar to example by React Team: https://github.com/reactwg/react-18/discussions/129#discussioncomment-2439125 | |
const ListItem = ({ id, name }) => { | |
let now = performance.now(); | |
while (performance.now() - now < 5) { |
This file contains hidden or 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 "./App.css"; | |
import { useState, useDeferredValue, memo, useEffect } from "react"; | |
import { fetchCities } from "./data/cities"; | |
const displayCount = 1000; | |
// code similar to example by React Team: https://github.com/reactwg/react-18/discussions/129#discussioncomment-2439125 | |
const ListItem = ({ id, name }) => { | |
let now = performance.now(); | |
while (performance.now() - now < 5) { |
This file contains hidden or 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 { fetchCities } from "../data/cities"; | |
export function fetchCityListData(displayCount) { | |
const cityPromise = fetchCities(displayCount); | |
return { | |
cities: wrapPromise(cityPromise), | |
}; | |
} | |
function wrapPromise(promise) { |
This file contains hidden or 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
// Author: Peter Kellner, https://peterkellner.net | |
import React from 'react'; | |
class ErrorBoundary extends React.Component { | |
state = { hasError: false }; | |
updateHasErrorsToFalse = () => { | |
this.setState(() => ({ | |
hasError: false, | |
})); |