Skip to content

Commit 0437e0c

Browse files
committed
Disabling SSR for the time being.
1 parent 786361e commit 0437e0c

File tree

3 files changed

+23
-13
lines changed

3 files changed

+23
-13
lines changed

src/components/Assignments/SolutionsTable/SolutionTableRowIcons.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ const SolutionTableRowIcons = ({
2424
<>
2525
<SolutionStatusIcon id={id} solution={solution} />
2626

27-
{review && <SolutionReviewIcon id={`review-${id}`} review={review} isReviewer={permissionHints.review} gapLeft />}
27+
{review && (
28+
<SolutionReviewIcon id={`review-${id}`} review={review} isReviewer={permissionHints.review || false} gapLeft />
29+
)}
2830

2931
{Boolean(plagiarism) && permissionHints.viewDetectedPlagiarisms && (
3032
<Link to={SOLUTION_PLAGIARISMS_URI_FACTORY(assignmentId, id)}>

src/locales/cs.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2069,4 +2069,4 @@
20692069
"recodex-judge-shuffle-all": "Sudí neuspořádaných tokenů a řádků",
20702070
"recodex-judge-shuffle-newline": "Sudí neuspořádaných tokenů (ignorující konce řádků)",
20712071
"recodex-judge-shuffle-rows": "Sudí neuspořádaných řádků"
2072-
}
2072+
}

src/server.js

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,19 @@
22
import 'cross-fetch/polyfill';
33

44
// server setup
5-
import React from 'react';
6-
import { Provider } from 'react-redux';
7-
import { renderToString } from 'react-dom/server';
85
import serialize from 'serialize-javascript';
96
import Express from 'express';
107
import ejs from 'ejs';
11-
import Promise from 'bluebird';
128
import Helmet from 'react-helmet';
139
import cookieParser from 'cookie-parser';
1410
import fs from 'fs';
1511
import { globSync } from 'glob';
1612

17-
import { StaticRouter } from 'react-router-dom/server';
18-
1913
import { configureStore } from './redux/store';
2014
import { loggedInUserIdSelector } from './redux/selectors/auth';
21-
import { isLoggedAsSuperAdmin } from './redux/selectors/users';
2215
import { match } from './pages/routes';
2316
import { TOKEN_COOKIES_KEY, INSTANCEID_COOKIES_KEY } from './redux/middleware/authMiddleware';
2417
import { LANG_COOKIES_KEY } from './redux/middleware/langMiddleware';
25-
import App from './containers/App';
2618

2719
import '@formatjs/intl-pluralrules/polyfill';
2820
import '@formatjs/intl-pluralrules/locale-data/en';
@@ -65,6 +57,11 @@ app.use(
6557
);
6658
app.use(cookieParser());
6759

60+
/**
61+
* Note: this method was originally created to support SSR (serialize store as well).
62+
* At present, we have no additional support for SSR and some features (like user IP locking)
63+
* will not work at all. SSR may be reintroduce in the future, but this should be rewritten.
64+
*/
6865
const renderPage = (res, store = null, html = '') => {
6966
const reduxState = store ? serialize(store.getState(), { isJSON: true }) : 'undefined';
7067
const head = Helmet.rewind();
@@ -86,16 +83,26 @@ app.get('*', (req, res) => {
8683
const lang = req.cookies[LANG_COOKIES_KEY] || null; // Selected instance
8784
const store = configureStore(undefined, token, instanceId, lang);
8885
const location = req.originalUrl;
89-
const context = {};
9086

9187
try {
88+
/*
89+
* Important!
90+
* Parts that were responsible for SSR were disabled on 26.1.2024.
91+
* SSR were not working properly and new API features (IP locking) were introduced
92+
* that are not SSR ready.
93+
* We keep the original code commented, so this may be fixed in the future.
94+
*/
95+
9296
const userId = loggedInUserIdSelector(store.getState()); // try to get the user ID from the token (if any)
93-
const isSuperadmin = isLoggedAsSuperAdmin(store.getState());
94-
const { redirect, params, loadAsync } = match(location, Boolean(userId));
97+
const { redirect /*, params, loadAsync */ } = match(location, Boolean(userId));
98+
// const isSuperadmin = isLoggedAsSuperAdmin(store.getState());
99+
// const context = {};
95100

96101
if (redirect) {
97102
res.redirect(302, redirect);
98103
} else {
104+
renderPage(res);
105+
/*
99106
Promise.all(
100107
loadAsync.map(la =>
101108
la(params, store.dispatch, {
@@ -116,6 +123,7 @@ app.get('*', (req, res) => {
116123
renderPage(res, store, html);
117124
})
118125
.catch(() => renderPage(res)); // without SSR
126+
*/
119127
}
120128
} catch (error) {
121129
res.status(500).send(error.message);

0 commit comments

Comments
 (0)