const theme = req.params.name;
if (!theme.endsWith(".css")) {
- res.statusCode = 400;
- res.send("Theme must be a css file");
+ return res.status(400).send("Theme must be a css file");
}
const customTheme = path.resolve(extraThemesFolder, theme);
if (existsSync(customTheme)) {
- res.sendFile(customTheme);
+ return res.sendFile(customTheme);
} else {
const internalTheme = path.resolve(`./dist/assets/css/themes/${theme}`);
// If the theme doesn't exist, just send litely
if (existsSync(internalTheme)) {
- res.sendFile(internalTheme);
+ return res.sendFile(internalTheme);
} else {
- res.sendFile(path.resolve("./dist/assets/css/themes/litely.css"));
+ return res.sendFile(path.resolve("./dist/assets/css/themes/litely.css"));
}
}
};
}
async componentDidMount() {
- if (!this.state.isIsomorphic) {
+ if (
+ !(this.state.isIsomorphic || this.props.history.location.state?.searched)
+ ) {
const promises = [this.fetchCommunities()];
if (this.state.searchText) {
promises.push(this.search());
sort: sort ?? urlSort,
};
- this.props.history.push(`/search${getQueryString(queryParams)}`);
+ this.props.history.push(`/search${getQueryString(queryParams)}`, {
+ searched: true,
+ });
await this.search();
}