-
- {this.props.name}:{' '}
- |
+ {this.props.name}: |
{
- if (binding.query) {
- spreadsheet.createQuery(sheetName, binding.name, binding.query);
+ useLayoutEffect(() => {
+ if (binding.query) {
+ spreadsheet.createQuery(sheetName, binding.name, binding.query);
+ }
+
+ return spreadsheet.bind(sheetName, binding, null, newResult => {
+ if (latestOnChange.current) {
+ latestOnChange.current(newResult);
}
- return spreadsheet.bind(sheetName, binding, null, newResult => {
- if (latestOnChange.current) {
- latestOnChange.current(newResult);
- }
-
- if (newResult.value !== latestValue.current) {
- setResult(newResult);
- }
- });
- },
- [sheetName, binding.name]
- );
+ if (newResult.value !== latestValue.current) {
+ setResult(newResult);
+ }
+ });
+ }, [sheetName, binding.name]);
return result.value != null ? children(result, setCell) : null;
}
diff --git a/packages/loot-design/src/components/spreadsheet/useSheetValue.js b/packages/loot-design/src/components/spreadsheet/useSheetValue.js
index 3dc9f56..6ed20ef 100644
--- a/packages/loot-design/src/components/spreadsheet/useSheetValue.js
+++ b/packages/loot-design/src/components/spreadsheet/useSheetValue.js
@@ -51,24 +51,21 @@ export default function useSheetValue(binding, onChange) {
latestValue.current = result.value;
});
- useLayoutEffect(
- () => {
- if (binding.query) {
- spreadsheet.createQuery(sheetName, binding.name, binding.query);
+ useLayoutEffect(() => {
+ if (binding.query) {
+ spreadsheet.createQuery(sheetName, binding.name, binding.query);
+ }
+
+ return spreadsheet.bind(sheetName, binding, null, newResult => {
+ if (latestOnChange.current) {
+ latestOnChange.current(newResult);
}
- return spreadsheet.bind(sheetName, binding, null, newResult => {
- if (latestOnChange.current) {
- latestOnChange.current(newResult);
- }
-
- if (newResult.value !== latestValue.current) {
- setResult(newResult);
- }
- });
- },
- [sheetName, binding.name]
- );
+ if (newResult.value !== latestValue.current) {
+ setResult(newResult);
+ }
+ });
+ }, [sheetName, binding.name]);
return result.value;
}
diff --git a/packages/loot-design/src/components/table.js b/packages/loot-design/src/components/table.js
index efe1ee1..4ff5922 100644
--- a/packages/loot-design/src/components/table.js
+++ b/packages/loot-design/src/components/table.js
@@ -31,10 +31,7 @@ import SheetValue from './spreadsheet/SheetValue';
import DateSelect from './DateSelect';
import format from './spreadsheet/format';
import { keys } from '../util/keys';
-import {
- AvoidRefocusScrollProvider,
- useProperFocus,
-} from './useProperFocus';
+import { AvoidRefocusScrollProvider, useProperFocus } from './useProperFocus';
import { useSelectedItems } from './useSelected';
export const ROW_HEIGHT = 32;
@@ -250,26 +247,23 @@ export function Row({
let rowRef = useRef(null);
let timer = useRef(null);
- useEffect(
- () => {
- if (highlighted && !prevHighlighted.current && rowRef.current) {
- rowRef.current.classList.add('animated');
- setShouldHighlight(true);
+ useEffect(() => {
+ if (highlighted && !prevHighlighted.current && rowRef.current) {
+ rowRef.current.classList.add('animated');
+ setShouldHighlight(true);
+
+ clearTimeout(timer.current);
+ timer.current = setTimeout(() => {
+ setShouldHighlight(false);
- clearTimeout(timer.current);
timer.current = setTimeout(() => {
- setShouldHighlight(false);
-
- timer.current = setTimeout(() => {
- if (rowRef.current) {
- rowRef.current.classList.remove('animated');
- }
- }, 500);
+ if (rowRef.current) {
+ rowRef.current.classList.remove('animated');
+ }
}, 500);
- }
- },
- [highlighted]
- );
+ }, 500);
+ }
+ }, [highlighted]);
useEffect(() => {
prevHighlighted.current = highlighted;
@@ -1233,8 +1227,8 @@ export function useTableNavigator(data, fields, opts = {}) {
? 'up'
: 'down'
: e.shiftKey
- ? 'left'
- : 'right'
+ ? 'left'
+ : 'right'
);
break;
default:
diff --git a/packages/loot-design/src/components/tooltips.js b/packages/loot-design/src/components/tooltips.js
index afc2f39..acd99d3 100644
--- a/packages/loot-design/src/components/tooltips.js
+++ b/packages/loot-design/src/components/tooltips.js
@@ -189,7 +189,8 @@ export class Tooltip extends React.Component {
// If it doesn't fit below it, switch it above only if it does
// fit above it
(this.position.indexOf('bottom') !== -1 &&
- (testBottom > containerRect.height && testTop > 0))
+ testBottom > containerRect.height &&
+ testTop > 0)
) {
// Invert the position
this.position = this.getOppositePosition(this.position);
diff --git a/packages/loot-design/src/parse-figma-theme.js b/packages/loot-design/src/parse-figma-theme.js
index 28c2a56..8795388 100644
--- a/packages/loot-design/src/parse-figma-theme.js
+++ b/packages/loot-design/src/parse-figma-theme.js
@@ -1,7 +1,7 @@
let fs = require('fs');
let contents = fs.readFileSync(process.argv[2], 'utf8');
-let list = contents.match(/(\#[0-9a-fA-F]*)/g);
+let list = contents.match(/(#[0-9a-fA-F]*)/g);
let groups = ['y', 'r', 'b', 'n', 'g', 'p'];
let colors = {};
diff --git a/packages/loot-design/src/setupTests.js b/packages/loot-design/src/setupTests.js
index ebf5e77..27fad9d 100644
--- a/packages/loot-design/src/setupTests.js
+++ b/packages/loot-design/src/setupTests.js
@@ -53,7 +53,7 @@ process.on('unhandledRejection', reason => {
});
global.afterEach(() => {
- __resetWorld();
+ global.__resetWorld();
});
// https://github.com/testing-library/react-testing-library#suppressing-unnecessary-warnings-on-react-dom-168
diff --git a/packages/loot-design/src/svg/Add.mobile.js b/packages/loot-design/src/svg/Add.mobile.js
index 1f16d3a..a121771 100644
--- a/packages/loot-design/src/svg/Add.mobile.js
+++ b/packages/loot-design/src/svg/Add.mobile.js
@@ -1,5 +1,5 @@
/* This file is auto-generated, do not touch! Please edit the SVG file instead. */
-import React from "react";
+import React from 'react';
import {
Svg,
@@ -18,9 +18,9 @@ import {
Use,
Defs,
Stop
-} from "mobile/node_modules/react-native-svg";
+} from 'mobile/node_modules/react-native-svg';
-function Add({ width, height, style, color = "black", ...props }) {
+function Add({ width, height, style, color = 'black', ...props }) {
return (
diff --git a/packages/loot-design/src/svg/Add.web.js b/packages/loot-design/src/svg/Add.web.js
index c651c73..ad94f41 100644
--- a/packages/loot-design/src/svg/Add.web.js
+++ b/packages/loot-design/src/svg/Add.web.js
@@ -1,8 +1,8 @@
/* This file is auto-generated, do not touch! Please edit the SVG file instead. */
-import React from "react";
-import { css } from "glamor";
+import React from 'react';
+import { css } from 'glamor';
-function Add({ width, height, style, color = "black", ...props }) {
+function Add({ width, height, style, color = 'black', ...props }) {
return (
diff --git a/packages/loot-design/src/svg/Bank.mobile.js b/packages/loot-design/src/svg/Bank.mobile.js
index 6f619a6..d71ce89 100644
--- a/packages/loot-design/src/svg/Bank.mobile.js
+++ b/packages/loot-design/src/svg/Bank.mobile.js
@@ -1,5 +1,5 @@
/* This file is auto-generated, do not touch! Please edit the SVG file instead. */
-import React from "react";
+import React from 'react';
import {
Svg,
@@ -18,9 +18,9 @@ import {
Use,
Defs,
Stop
-} from "mobile/node_modules/react-native-svg";
+} from 'mobile/node_modules/react-native-svg';
-function Bank({ width, height, style, color = "black", ...props }) {
+function Bank({ width, height, style, color = 'black', ...props }) {
return (
;
-function LeftArrow3({ width, height, style, color = "black", ...props }) {
+function LeftArrow3({ width, height, style, color = 'black', ...props }) {
return (
diff --git a/packages/loot-design/src/svg/Pencil.web.js b/packages/loot-design/src/svg/Pencil.web.js
index b3d23ce..1e82041 100644
--- a/packages/loot-design/src/svg/Pencil.web.js
+++ b/packages/loot-design/src/svg/Pencil.web.js
@@ -1,8 +1,8 @@
/* This file is auto-generated, do not touch! Please edit the SVG file instead. */
-import React from "react";
-import { css } from "glamor";
+import React from 'react';
+import { css } from 'glamor';
-function Pencil({ width, height, style, color = "black", ...props }) {
+function Pencil({ width, height, style, color = 'black', ...props }) {
return (
diff --git a/packages/loot-design/src/svg/Reports.mobile.js b/packages/loot-design/src/svg/Reports.mobile.js
index 073f8dc..2ab8844 100644
--- a/packages/loot-design/src/svg/Reports.mobile.js
+++ b/packages/loot-design/src/svg/Reports.mobile.js
@@ -1,5 +1,5 @@
/* This file is auto-generated, do not touch! Please edit the SVG file instead. */
-import React from "react";
+import React from 'react';
import {
Svg,
@@ -18,9 +18,9 @@ import {
Use,
Defs,
Stop
-} from "mobile/node_modules/react-native-svg";
+} from 'mobile/node_modules/react-native-svg';
-function Reports({ width, height, style, color = "black", ...props }) {
+function Reports({ width, height, style, color = 'black', ...props }) {
return (
diff --git a/packages/loot-design/src/svg/logo/Logo.ios.js b/packages/loot-design/src/svg/logo/Logo.ios.js
index ec43b37..cd74b3a 100644
--- a/packages/loot-design/src/svg/logo/Logo.ios.js
+++ b/packages/loot-design/src/svg/logo/Logo.ios.js
@@ -1,5 +1,5 @@
-import React from "react";
-import Svg, { Path } from "react-native-svg";
+import React from 'react';
+import Svg, { Path } from 'react-native-svg';
const SvgLogo = props => (
|