Skip to content

Commit

Permalink
New approach to try to solve the warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Mister-Mario committed Apr 13, 2024
1 parent aa30e31 commit 278116f
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,5 @@ jobs:
- run: npm --prefix users/userservice install
- run: npm --prefix gatewayservice install
- run: npm --prefix webapp install
- run: process.env.CI=false npm --prefix webapp run build
- run: npm --prefix webapp run build
- run: npm --prefix webapp run test:e2e
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
- run: npm --prefix users/userservice install
- run: npm --prefix gatewayservice install
- run: npm --prefix webapp install
- run: process.env.CI=false npm --prefix webapp run build
- run: npm --prefix webapp run build
- run: npm --prefix webapp run test:e2e
docker-push-webapp:
name: Push webapp Docker Image to GitHub Packages
Expand Down
25 changes: 14 additions & 11 deletions webapp/src/components/HistoricalData/HistoricalView.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, {useEffect, useState } from 'react';
import React, { useState } from 'react';
import {useTranslation} from "react-i18next";
import HistoryRecordRetriever from './HistoryRecordRetriever';
import { useUserContext } from '../loginAndRegistration/UserContext';
Expand All @@ -10,20 +10,23 @@ const retriever = new HistoryRecordRetriever();


export default function HistoricalView() {
const [records, setRecords]= useState([]);
const [records, setRecords]= useState(null);
const[t] = useTranslation("global");
const {user} = useUserContext();

const getRecords = async ()=>{
try {
var jsonRecords = await retriever.getRecords(user.username);
var recordsArray = jsonRecords.games;
setRecords(recordsArray);
} catch (error) {
console.log(error);
}
const getRecords = async ()=>{
try {
var jsonRecords = await retriever.getRecords(user.username);
var recordsArray = jsonRecords.games;
setRecords(recordsArray);
} catch (error) {
console.log(error);
}
}
useEffect(() => {getRecords()}, []);

if(records === null)
getRecords();

return (
<div className='globalHistoricalView'>
{(records && records.length !== 0) ? records.map((record, index) => (
Expand Down
8 changes: 5 additions & 3 deletions webapp/src/components/questionView/QuestionView.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import QuestionGenerator from './QuestionGenerator';
import CreationHistoricalRecord from './CreationHistoricalRecord';
import { useEffect, useState } from 'react';
import { useState } from 'react';
import "../../custom.css";
import React from "react";
import Countdown from 'react-countdown';
Expand All @@ -15,7 +15,7 @@ const questionGenerator = new QuestionGenerator();
var points = 0;
function QuestionView(){
const [numQuestion, setnumQuestion] = useState(-1);
const [questions, setQuestions] = useState([]);
const [questions, setQuestions] = useState(null);
const[t, i18n] = useTranslation("global");
const {user} = useUserContext();

Expand Down Expand Up @@ -98,7 +98,9 @@ function QuestionView(){

}

useEffect(() => {generateQuestions(numQuestion)}, []);
if(questions === null)
generateQuestions(numQuestion)


return (
<div className="question-view-container">
Expand Down

0 comments on commit 278116f

Please sign in to comment.