Attention une mise à jour du service Gitlab va être effectuée le mardi 30 novembre entre 17h30 et 18h00. Cette mise à jour va générer une interruption du service dont nous ne maîtrisons pas complètement la durée mais qui ne devrait pas excéder quelques minutes. Cette mise à jour intermédiaire en version 14.0.12 nous permettra de rapidement pouvoir mettre à votre disposition une version plus récente.

Commit 6f12ba96 authored by Yannick Li's avatar Yannick Li
Browse files

Add call to pull method of the collection and update package.json

parent 79d42d07
Pipeline #246617 failed with stages
This diff is collapsed.
......@@ -6,23 +6,22 @@
"license": "MIT",
"homepage": "./",
"dependencies": {
"@concordant/c-client": "^1.0.0",
"@concordant/c-crdtlib": "^1.0.2",
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
"@types/jest": "^26.0.15",
"@types/node": "^12.0.0",
"@types/react": "^16.9.53",
"@types/react-dom": "^16.9.8",
"@types/react-helmet": "^6.1.0",
"@concordant/c-client": "~1.2.0",
"@testing-library/jest-dom": "^5.12.0",
"@testing-library/react": "^11.2.6",
"@testing-library/user-event": "^13.1.8",
"@types/jest": "^26.0.23",
"@types/node": "^14.14.44",
"@types/react": "^17.0.5",
"@types/react-dom": "^17.0.3",
"@types/react-helmet": "^6.1.1",
"assert": "^2.0.0",
"react": "^16.14.0",
"react-dom": "^16.14.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-helmet": "^6.1.0",
"react-scripts": "^4.0.3",
"typescript": "^4.0.3",
"web-vitals": "^0.2.4"
"typescript": "^4.2.4",
"web-vitals": "^1.1.2"
},
"scripts": {
"start": "react-scripts start",
......@@ -46,15 +45,15 @@
]
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^4.22.0",
"@typescript-eslint/parser": "^4.22.0",
"@typescript-eslint/eslint-plugin": "^4.22.1",
"@typescript-eslint/parser": "^4.22.1",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.5",
"eslint": "^7.24.0",
"eslint": "^7.25.0",
"eslint-plugin-react": "^7.23.2",
"prettier": "2.2.1",
"husky": "^6.0.0",
"lint-staged": "^10.5.4"
"lint-staged": "^10.5.4",
"prettier": "2.2.1"
},
"lint-staged": {
"*.{js,ts,tsx}": "eslint --cache --fix",
......
......@@ -79,13 +79,23 @@ class Game extends React.Component<Record<string, unknown>, IGameState> {
};
}
/**
* Every 3 seconds, retrieves remote changes
*/
private setSyncTimer() {
this.timerID = setTimeout(() => {
this.pullGrid();
this.setSyncTimer();
}, 3000);
}
/**
* Called after the component is rendered.
* It set a timer to refresh cells values.
*/
componentDidMount(): void {
this.initFrom(generateStaticGrid(this.state.gridNum));
this.timerID = setInterval(() => this.updateGrid(), 1000);
this.setSyncTimer();
}
/**
......@@ -99,12 +109,13 @@ class Game extends React.Component<Record<string, unknown>, IGameState> {
/**
* Update cells values from C-Client.
*/
updateGrid(): void {
const cells = this.state.cells;
pullGrid(): void {
if (!this.state.isConnected) {
console.error("updateGrid() called while not connected.");
return;
}
const cells = this.state.cells;
collection.pull(client.utils.ConsistencyLevel.None);
for (let index = 0; index < 81; index++) {
if (cells[index].modifiable) {
cells[index].value = "";
......@@ -138,7 +149,7 @@ class Game extends React.Component<Record<string, unknown>, IGameState> {
});
}
}
this.timerID = setInterval(() => this.updateGrid(), 1000);
this.setSyncTimer();
}
this.setState({ isConnected: !this.state.isConnected });
}
......
This diff is collapsed.
......@@ -6,21 +6,21 @@
"license": "MIT",
"homepage": "./",
"dependencies": {
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
"@types/jest": "^26.0.15",
"@types/node": "^12.0.0",
"@types/react": "^16.9.53",
"@types/react-dom": "^16.9.8",
"@types/react-helmet": "^6.1.0",
"@testing-library/jest-dom": "^5.12.0",
"@testing-library/react": "^11.2.6",
"@testing-library/user-event": "^13.1.8",
"@types/jest": "^26.0.23",
"@types/node": "^14.14.44",
"@types/react": "^17.0.5",
"@types/react-dom": "^17.0.3",
"@types/react-helmet": "^6.1.1",
"assert": "^2.0.0",
"react": "^16.14.0",
"react-dom": "^16.14.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-helmet": "^6.1.0",
"react-scripts": "^4.0.3",
"typescript": "^4.0.3",
"web-vitals": "^0.2.4"
"typescript": "^4.2.4",
"web-vitals": "^1.1.2"
},
"scripts": {
"start": "react-scripts start",
......@@ -44,11 +44,11 @@
]
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^4.22.0",
"@typescript-eslint/parser": "^4.22.0",
"@typescript-eslint/eslint-plugin": "^4.22.1",
"@typescript-eslint/parser": "^4.22.1",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.5",
"eslint": "^7.24.0",
"eslint": "^7.25.0",
"eslint-plugin-react": "^7.23.2",
"husky": "^6.0.0",
"lint-staged": "^10.5.4",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment