Skip to content

Commit 50df8d6

Browse files
committed
Merge branch 'develop' into production
2 parents 53187b3 + d949a91 commit 50df8d6

15 files changed

+4330
-6449
lines changed

.husky/pre-commit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
yarn lint-staged && CI=1 yarn test

config-overrides.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
const webpack = require("webpack");
2+
3+
module.exports = function override(config) {
4+
config.resolve.fallback = {
5+
util: require.resolve("util"),
6+
process: require.resolve("process/browser"),
7+
assert: require.resolve("assert"),
8+
buffer: require.resolve("buffer"),
9+
stream: require.resolve("stream-browserify"),
10+
};
11+
12+
config.plugins.push(
13+
new webpack.ProvidePlugin({
14+
process: "process/browser",
15+
Buffer: ["buffer", "Buffer"],
16+
})
17+
);
18+
19+
return config;
20+
};

package.json

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,34 +12,42 @@
1212
"homepage": "https://grouptabs.net/",
1313
"dependencies": {
1414
"@seznam/compose-react-refs": "^1.0.6",
15-
"@types/jest": "^26.0.24",
15+
"@testing-library/jest-dom": "^5.14.1",
16+
"@testing-library/react": "^13.0.0",
17+
"@testing-library/user-event": "^14.1.1",
18+
"@types/jest": "^27.4.1",
1619
"@types/node": "^14.17.32",
1720
"@types/pouchdb": "^6.4.0",
18-
"@types/react": "^17.0.34",
19-
"@types/react-dom": "^17.0.11",
20-
"@types/react-redux": "^7.1.20",
21-
"@types/react-test-renderer": "^17.0.1",
21+
"@types/react": "^18.0.5",
22+
"@types/react-dom": "^18.0.1",
23+
"@types/react-test-renderer": "^18.0.0",
2224
"@types/redux-first-router": "^2.1.7",
2325
"@types/uuid": "^8.3.1",
26+
"assert": "^2.0.0",
27+
"buffer": "^6.0.3",
2428
"debug": "^4.3.2",
25-
"husky": "^4.3.8",
26-
"lint-staged": "^10.5.4",
29+
"husky": "^7.0.4",
30+
"lint-staged": "^12.3.7",
2731
"lodash.orderby": "^4.6.0",
2832
"lodash.throttle": "^4.1.1",
2933
"pouchdb-adapter-memory": "^7.2.2",
3034
"pouchdb-browser": "^7.2.2",
3135
"prettier": "^2.4.1",
32-
"react": "^17.0.2",
33-
"react-dom": "^17.0.2",
34-
"react-redux": "^7.2.6",
35-
"react-scripts": "4.0.3",
36-
"react-test-renderer": "^17.0.2",
37-
"redux": "^4.1.2",
36+
"process": "^0.11.10",
37+
"react": "^18.0.0",
38+
"react-app-rewired": "^2.2.1",
39+
"react-dom": "^18.0.0",
40+
"react-redux": "^8.0.0",
41+
"react-scripts": "5.0.1",
42+
"react-test-renderer": "^18.0.0",
43+
"redux": "^4.2.0",
3844
"redux-first-router": "^2.1.5",
3945
"redux-thunk": "^2.4.0",
4046
"reselect": "^4.1.2",
4147
"smooth-scroll": "^16.1.3",
48+
"stream-browserify": "^3.0.0",
4249
"typescript": "^4.4.4",
50+
"util": "^0.12.4",
4351
"uuid": "^8.3.2",
4452
"workbox-background-sync": "^5.1.4",
4553
"workbox-broadcast-update": "^5.1.4",
@@ -55,10 +63,11 @@
5563
"workbox-streams": "^5.1.4"
5664
},
5765
"scripts": {
58-
"start": "REACT_APP_GT_VERSION=`git describe HEAD` react-scripts start",
59-
"build": "REACT_APP_GT_VERSION=`git describe HEAD` react-scripts build",
66+
"postinstall": "husky install",
67+
"start": "REACT_APP_GT_VERSION=${REACT_APP_GT_VERSION:-`git describe HEAD`} react-app-rewired start",
68+
"build": "REACT_APP_GT_VERSION=${REACT_APP_GT_VERSION:-`git describe HEAD`} react-app-rewired build",
6069
"pretest": "tsc",
61-
"test": "LC_ALL=en_US react-scripts test",
70+
"test": "LC_ALL=en_US react-app-rewired test",
6271
"eject": "react-scripts eject"
6372
},
6473
"eslintConfig": {
@@ -81,11 +90,6 @@
8190
]
8291
},
8392
"license": "GPL-3.0",
84-
"husky": {
85-
"hooks": {
86-
"pre-commit": "lint-staged && CI=1 npm test"
87-
}
88-
},
8993
"lint-staged": {
9094
"src/**/*.{js,jsx,ts,tsx,json,css,scss,md}": [
9195
"prettier --write"

release-notes.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@ description: >
33
Track expenses in a group of people!
44
55
releases:
6+
- version: 1.5.2
7+
date: 2022-06-06
8+
description: Bug fixes and updates
9+
fixed:
10+
- Fixed memory leak by updating PouchDB
11+
changed:
12+
- Update libraries, in particular Create React App to version 5 and React to version 18
613
- version: 1.5.1
714
date: 2022-04-04
815
description: Small improvements and updates

src/components/__snapshots__/main.test.tsx.snap

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@ exports[`renders empty view with no tab selected 1`] = `
2020
/>
2121
</svg>
2222
</button>
23-
<h2>
24-
25-
</h2>
23+
<h2 />
2624
<button
2725
className="create"
2826
onClick={[Function]}
@@ -83,9 +81,7 @@ exports[`renders missing tab info error 1`] = `
8381
/>
8482
</svg>
8583
</button>
86-
<h2>
87-
88-
</h2>
84+
<h2 />
8985
<button
9086
className="create"
9187
onClick={[Function]}

src/components/__snapshots__/tabs.test.tsx.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ exports[`renders empty tab view 1`] = `
6464
</main>
6565
<footer>
6666
Version:
67-
VERSION
67+
N/A
6868
6969
7070
<a
@@ -143,7 +143,7 @@ exports[`renders tab view 1`] = `
143143
</main>
144144
<footer>
145145
Version:
146-
VERSION
146+
N/A
147147
148148
149149
<a

src/components/app.test.tsx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
import React from "react";
2-
import ReactDOM from "react-dom";
2+
import { render, screen } from "@testing-library/react";
33
import App from "./app";
4-
import { act } from "react-dom/test-utils";
54

6-
it("renders without crashing", () => {
7-
const div = document.createElement("div");
5+
it("renders Grouptabs heading", () => {
86
const props: any = {
97
location: {
108
type: "",
@@ -35,8 +33,6 @@ it("renders without crashing", () => {
3533
onAddParticipant: jest.fn(),
3634
onSetAllJoined: jest.fn(),
3735
};
38-
act(() => {
39-
ReactDOM.render(<App {...props} />, div);
40-
});
41-
ReactDOM.unmountComponentAtNode(div);
36+
render(<App {...props} />);
37+
expect(screen.getAllByText("Grouptabs")[0]).toBeInTheDocument();
4238
});

src/components/app.tsx

Lines changed: 58 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -94,70 +94,66 @@ export default class App extends Component<Props> {
9494
}
9595

9696
return (
97-
<React.StrictMode>
98-
<div className="scenes">
99-
<div
100-
className={`scenes-container scenes-container-active-${getSceneIndex(
101-
this.props.location.type
102-
)}`}
103-
>
104-
<Tabs
105-
data={this.props.tabs}
106-
visible={this.props.currentLocation === ROUTE_TABS}
107-
checkingRemoteTab={this.props.checkingRemoteTab}
108-
remoteTabError={this.props.remoteTabError}
109-
createTabInputValue={this.props.createTabInputValue}
110-
importTabInputValue={this.props.importTabInputValue}
111-
onTabClick={this.props.onSelectTab}
112-
onCreateTabInputChange={this.props.onCreateTabInputChange}
113-
onCreateNewTab={this.props.onCreateTab}
114-
onImportTabInputChange={this.props.onImportTabInputChange}
115-
onImportTab={this.props.onImportTab}
116-
/>
117-
<Main
118-
tabInfo={this.props.tabInfo}
119-
tabId={this.props.location.payload.tabId}
120-
accounts={this.props.accounts}
121-
transactions={this.props.transactions}
122-
total={this.props.total}
123-
visible={this.props.currentLocation === ROUTE_TAB}
124-
checkingRemoteTab={this.props.checkingRemoteTab}
125-
remoteTabError={this.props.remoteTabError}
126-
importingTab={this.props.importingTab}
127-
onChangeTabClick={this.props.onNavigateToTabs}
128-
onNavigateToAddTransaction={this.props.onNavigateToAddTransaction}
129-
onDetailsClick={this.props.onNavigateToUpdateTransaction}
130-
/>
131-
<div className="scene editEntryScene">
132-
{this.getShowEditEntry() && (
133-
<EditEntry
134-
visible={
135-
this.props.currentLocation === ROUTE_TRANSACTION ||
136-
this.props.currentLocation === ROUTE_NEW_TRANSACTION
137-
}
138-
mode={this.getEditEntryMode()}
139-
formState={this.props.transactionFormState}
140-
checkingRemoteTab={this.props.checkingRemoteTab}
141-
remoteTabError={this.props.remoteTabError}
142-
importingTab={this.props.importingTab}
143-
onChangeTabClick={this.props.onNavigateToTabs}
144-
onCloseClick={this.props.onCloseTransaction}
145-
onSave={this.props.onAddOrUpdateTransaction}
146-
onDelete={this.props.onRemoveTransaction}
147-
onUpdateForm={this.props.onUpdateTransactionForm}
148-
onUpdateSharedForm={this.props.onUpdateTransactionSharedForm}
149-
onUpdateDirectForm={this.props.onUpdateTransactionDirectForm}
150-
onUpdateParticipant={
151-
this.props.onUpdateTransactionParticipant
152-
}
153-
onAddParticipant={this.props.onAddParticipant}
154-
onSetAllJoined={this.props.onSetAllJoined}
155-
/>
156-
)}
157-
</div>
97+
<div className="scenes">
98+
<div
99+
className={`scenes-container scenes-container-active-${getSceneIndex(
100+
this.props.location.type
101+
)}`}
102+
>
103+
<Tabs
104+
data={this.props.tabs}
105+
visible={this.props.currentLocation === ROUTE_TABS}
106+
checkingRemoteTab={this.props.checkingRemoteTab}
107+
remoteTabError={this.props.remoteTabError}
108+
createTabInputValue={this.props.createTabInputValue}
109+
importTabInputValue={this.props.importTabInputValue}
110+
onTabClick={this.props.onSelectTab}
111+
onCreateTabInputChange={this.props.onCreateTabInputChange}
112+
onCreateNewTab={this.props.onCreateTab}
113+
onImportTabInputChange={this.props.onImportTabInputChange}
114+
onImportTab={this.props.onImportTab}
115+
/>
116+
<Main
117+
tabInfo={this.props.tabInfo}
118+
tabId={this.props.location.payload.tabId}
119+
accounts={this.props.accounts}
120+
transactions={this.props.transactions}
121+
total={this.props.total}
122+
visible={this.props.currentLocation === ROUTE_TAB}
123+
checkingRemoteTab={this.props.checkingRemoteTab}
124+
remoteTabError={this.props.remoteTabError}
125+
importingTab={this.props.importingTab}
126+
onChangeTabClick={this.props.onNavigateToTabs}
127+
onNavigateToAddTransaction={this.props.onNavigateToAddTransaction}
128+
onDetailsClick={this.props.onNavigateToUpdateTransaction}
129+
/>
130+
<div className="scene editEntryScene">
131+
{this.getShowEditEntry() && (
132+
<EditEntry
133+
visible={
134+
this.props.currentLocation === ROUTE_TRANSACTION ||
135+
this.props.currentLocation === ROUTE_NEW_TRANSACTION
136+
}
137+
mode={this.getEditEntryMode()}
138+
formState={this.props.transactionFormState}
139+
checkingRemoteTab={this.props.checkingRemoteTab}
140+
remoteTabError={this.props.remoteTabError}
141+
importingTab={this.props.importingTab}
142+
onChangeTabClick={this.props.onNavigateToTabs}
143+
onCloseClick={this.props.onCloseTransaction}
144+
onSave={this.props.onAddOrUpdateTransaction}
145+
onDelete={this.props.onRemoveTransaction}
146+
onUpdateForm={this.props.onUpdateTransactionForm}
147+
onUpdateSharedForm={this.props.onUpdateTransactionSharedForm}
148+
onUpdateDirectForm={this.props.onUpdateTransactionDirectForm}
149+
onUpdateParticipant={this.props.onUpdateTransactionParticipant}
150+
onAddParticipant={this.props.onAddParticipant}
151+
onSetAllJoined={this.props.onSetAllJoined}
152+
/>
153+
)}
158154
</div>
159155
</div>
160-
</React.StrictMode>
156+
</div>
161157
);
162158
}
163159
}

src/components/editentry.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { ReactFragment, FunctionComponent, memo } from "react";
1+
import React, { ReactElement, FunctionComponent, memo } from "react";
22
import Loader from "./loader";
33
import Form from "./form";
44
import LoadError from "./loaderror";
@@ -28,7 +28,7 @@ interface Props {
2828
const EditEntry: FunctionComponent<Props> = (props) => {
2929
const [isScrolled, scrollContainerRef] = useScrollIndicator();
3030

31-
const renderHeader = (showSaveButton: boolean): ReactFragment => (
31+
const renderHeader = (showSaveButton: boolean): ReactElement => (
3232
<div className={`header${isScrolled ? " elevated" : ""}`}>
3333
<button className="left" onClick={props.onCloseClick}>
3434
<svg height="16" width="16">

src/components/form.test.tsx

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React from "react";
22
import renderer from "react-test-renderer";
3+
import { render, screen } from "@testing-library/react";
34
import Form from "./form";
45
import {
56
TransactionType,
@@ -8,7 +9,6 @@ import {
89
TransactionFormParticipantInputType as InputType,
910
} from "../types";
1011
import { createFormData } from "../util/transactionform";
11-
import { unmountComponentAtNode, render } from "react-dom";
1212

1313
let realDate: any;
1414

@@ -102,18 +102,6 @@ it("renders prefilled form", () => {
102102
});
103103

104104
describe('"all joined" button', () => {
105-
let container: any = null;
106-
beforeEach(() => {
107-
container = document.createElement("div");
108-
document.body.appendChild(container);
109-
});
110-
111-
afterEach(() => {
112-
unmountComponentAtNode(container);
113-
container.remove();
114-
container = null;
115-
});
116-
117105
it("shows button for 2 unjoined participants", () => {
118106
render(
119107
<Form
@@ -145,11 +133,10 @@ describe('"all joined" button', () => {
145133
onSetAllJoined={jest.fn()}
146134
onSave={jest.fn()}
147135
onDelete={jest.fn()}
148-
/>,
149-
container
136+
/>
150137
);
151138

152-
expect(container.querySelector(".all-joined")).toBeTruthy();
139+
expect(screen.getByText("all joined")).toBeInTheDocument();
153140
});
154141

155142
it("shows no button for 2 joined and 1 unjoined participant", () => {
@@ -188,10 +175,9 @@ describe('"all joined" button', () => {
188175
onSetAllJoined={jest.fn()}
189176
onSave={jest.fn()}
190177
onDelete={jest.fn()}
191-
/>,
192-
container
178+
/>
193179
);
194180

195-
expect(container.querySelector(".all-joined")).toBeNull();
181+
expect(screen.queryByText("all joined")).not.toBeInTheDocument();
196182
});
197183
});

0 commit comments

Comments
 (0)