| (async () => { | |
| const { getBlocksuiteReader } = await import( | |
| "https://unpkg.com/[email protected]/dist/index.js" | |
| ); | |
| const workspace = window.currentBlockSuiteWorkspace; | |
| const workspaceId = workspace.room; | |
| const reader = getBlocksuiteReader({ | |
| workspaceId: workspaceId, | |
| Y: workspace.constructor.Y, | |
| }); |
| export class Cache<T extends object, K> { | |
| items = new WeakMap<T, K>() | |
| get<P extends T>(item: P, cb: (item: P) => K) { | |
| if (!this.items.has(item)) { | |
| this.items.set(item, cb(item)) | |
| } | |
| return this.items.get(item)! | |
| } |
| /** | |
| * RuntimeGlobalsChecker | |
| * | |
| * You can use this utility to quickly check what variables have been added (or | |
| * leaked) to the global window object at runtime (by JavaScript code). | |
| * By running this code, the globals checker itself is attached as a singleton | |
| * to the window object as "__runtimeGlobalsChecker__". | |
| * You can check the runtime globals programmatically at any time by invoking | |
| * "window.__runtimeGlobalsChecker__.getRuntimeGlobals()". | |
| * |
| /* | |
| * credit to Dhrumil Shah (@wandcrafting) and Robert Haisfield (@RobertHaisfield) | |
| * for the original concept which was part of their RoamGames submission | |
| * and can be found at: https://www.figma.com/file/5shwLdUCHxSaPNEO7pazbe/ | |
| * | |
| */ | |
| /* ======= OPTIONS ======== */ | |
| /* note: if you change these, reload the page to see the effect */ |
| import { Suspense, useLayoutEffect, useRef, useState } from 'react'; | |
| type IFrameProps = React.ComponentPropsWithRef<'iframe'> & { | |
| fallback?: JSX.Element; | |
| }; | |
| export function IFrame(props: IFrameProps) { | |
| const { fallback, ...rest } = props; | |
| return ( |
| #!/usr/bin/env bash | |
| # Bash script to download Apache NetBeans and (optionally) a JDK, then package into an AppImage. | |
| # | |
| # Use at own risk! Will create a /build directory inside current directory for downloading and | |
| # building. AppImage will be created in current directory. | |
| # | |
| # (c) 2020 Neil C Smith - [email protected] | |
| shopt -s extglob |
[12:14 AM] acreddy : are hooks value stored in fiber?
[10:40 AM] ghardin137 : not really
[10:50 AM] acemarke : @acreddy, @ghardin137 : yes they are, actually.
A "fiber" is a plain JS object that React uses to store bookkeeping information on each rendered component in the tree. The linked list of hooks is indeed stored as a field on the fiber for that component
I heard some points of criticism to how React deals with reactivity and it's focus on "purity". It's interesting because there are really two approaches evolving. There's a mutable + change tracking approach and there's an immutability + referential equality testing approach. It's difficult to mix and match them when you build new features on top. So that's why React has been pushing a bit harder on immutability lately to be able to build on top of it. Both have various tradeoffs but others are doing good research in other areas, so we've decided to focus on this direction and see where it leads us.
I did want to address a few points that I didn't see get enough consideration around the tradeoffs. So here's a small brain dump.
"Compiled output results in smaller apps" - E.g. Svelte apps start smaller but the compiler output is 3-4x larger per component than the equivalent VDOM approach. This is mostly due to the code that is usually shared in the VDOM "VM" needs to be inlined into each component. The tr