Skip to content

Commit

Permalink
Small memory optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
willcrichton committed Aug 4, 2021
1 parent 4d777d2 commit 0c9f27e
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion build.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ program.parse(process.argv);
const options = program.opts();

let esbuild_opts = {
sourcemap: !options.prod,
sourcemap: true,
minify: options.prod,
watch: options.watch,
outdir: "dist",
Expand Down
2 changes: 1 addition & 1 deletion examples/hatra/build.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ esbuild
.build({
entryPoints: ["src/index.tsx"],
bundle: true,
sourcemap: !options.prod,
sourcemap: true,
minify: options.prod,
watch: options.watch,
preserveSymlinks: true,
Expand Down
2 changes: 1 addition & 1 deletion examples/slicing/build.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const avoid_peerdep_conflicts_plugin = {
};

let esbuild_opts = {
sourcemap: !options.prod,
sourcemap: true,
minify: options.prod,
watch: options.watch,
bundle: true,
Expand Down
2 changes: 1 addition & 1 deletion src/definitions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export interface DefinitionData {
}

export class AllDefinitionData {
@observable defs: { [name: string]: DefinitionData } = {};
@observable.shallow defs: { [name: string]: DefinitionData } = {};
@observable def_mode: boolean = false;
@observable used_definitions: Set<string> = new Set();

Expand Down
2 changes: 0 additions & 2 deletions src/tex.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ export class TexContext {
let defns = new H2R.ProcessNodeDefinitions(React);
let instrs = [
{
replaceChildren: true,
shouldProcessNode: (node: any) => node.attribs && "data-cmd" in node.attribs,
processNode: (node: any, children: any, index: any) => {
let def = node.attribs["data-cmd"];
Expand All @@ -122,7 +121,6 @@ export class TexContext {
},
},
{
replaceChildren: true,
shouldProcessNode: (node: any) => node.attribs && "data-def" in node.attribs,
processNode: (node: any, children: any, index: any) => {
let def = node.attribs["data-def"];
Expand Down
5 changes: 2 additions & 3 deletions src/togglebox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React, { useState, useRef, useEffect, useCallback, forwardRef, CSSPropert
import { useSynchronizer, useStateOnInterval } from "./utils";
import classNames from "classnames";


interface ToggleboxProps {
Inside: React.FC;
Outside: React.FC;
Expand All @@ -27,8 +26,8 @@ export let Togglebox: React.FC<ToggleboxProps> = ({ Inside, Outside, resize, reg

if (registerToggle) {
useEffect(() => {
registerToggle((show: boolean) => set_show_inside(show));
}, []);
registerToggle(set_show_inside);
}, [registerToggle]);
}

let style = useStateOnInterval({}, 1000, () => {
Expand Down

0 comments on commit 0c9f27e

Please sign in to comment.