Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: tree page crashes in Classifications #1051

Merged
merged 1 commit into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,5 @@
"statusBar.background": "#42b883",
"statusBarItem.hoverBackground": "#359268",
"statusBar.foreground": "#15202b"
},
"peacock.color": "#42b883"
}
}
6 changes: 2 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
### BUILD STEP ###

FROM node:latest as builder
FROM node:latest AS builder

WORKDIR /bauhaus

COPY ./ ./

RUN npm install --force

RUN npm run build
RUN npm install --force && npm run build

### EXECUTION STEP ###

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Web application for the management of concepts, classifications and other statis
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=InseeFr_Bauhaus&metric=coverage)](https://sonarcloud.io/dashboard?id=InseeFr_Bauhaus)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)

The documentation can be found in the [docs](https://github.com/InseeFr/Bauhaus/tree/main/documentation/src/content/docs) folder and [browsed online](https://inseefr.github.io/Bauhaus).
The documentation can be found in the [documentation folder](https://github.com/InseeFr/Bauhaus/tree/main/documentation/src/content/docs) and [browsed online](https://inseefr.github.io/Bauhaus).

## How to start

Expand All @@ -28,7 +28,7 @@ You can run all tests suites with this command. You need to run at least once `n
npm run test:coverage
```

The following command will activate the `watch` mode, and you will be able to select a subset of tests you want to run.
The following command will activate the **watch** mode, and you will be able to select a subset of tests you want to run.

```shell
npm run test --watchAll
Expand Down
2 changes: 1 addition & 1 deletion sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ sonar.host.url=https://sonarcloud.io

# Project name & version
sonar.projectName=Bauhaus
sonar.projectVersion=3.1.2
sonar.projectVersion=4.1.1

# Path to sources
sonar.sources=src
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ import { getGeneral } from '../../../redux/classifications/classification/genera
import { getTreeFromFlatData } from 'react-sortable-tree';
import { useSecondLang } from '../../../utils/hooks/second-lang';
import { useClassificationsItem } from '../../../utils/hooks/classifications';
import { buildExtract } from '../../../utils/buildExtract';

const extractId = buildExtract('id');
import { useParams } from 'react-router-dom';

const ClassificationTreeContainer = ({
id,
Expand Down Expand Up @@ -52,7 +50,7 @@ const ClassificationTreeContainer = ({
};

const mapStateToProps = (state, ownProps) => {
const id = extractId(ownProps);
const id = ownProps.params.id;
const general = getGeneral(state.classificationGeneral, id);
return {
id,
Expand All @@ -64,7 +62,13 @@ const mapDispatchToProps = {
loadClassificationGeneral,
};

export const Component = connect(
mapStateToProps,
mapDispatchToProps,
)(ClassificationTreeContainer);
const withParams = (Component) => {
return (props) => {
const params = useParams();
return <Component {...props} params={params} />;
};
};

export const Component = withParams(
connect(mapStateToProps, mapDispatchToProps)(ClassificationTreeContainer),
);
3 changes: 0 additions & 3 deletions src/packages/utils/buildExtract.ts

This file was deleted.

Loading