mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-08 22:45:45 +01:00
Introduce stale while revalidate pattern (#1555)
This Improves the frontend performance with stale while revalidate pattern. There are noticeable performance problems in the frontend that needed addressing. While implementing the stale-while-revalidate pattern to display cached responses while re-fetching up-to-date data in the background, in the same vein we used the opportunity to remove legacy code involving redux as much as possible, cleaned up many components and converted them to functional react components. Co-authored-by: Sebastian Sdorra <sebastian.sdorra@cloudogu.com> Co-authored-by: Eduard Heimbuch <eduard.heimbuch@cloudogu.com>
This commit is contained in:
committed by
GitHub
parent
ad5c8102c0
commit
3a8d031ed5
@@ -27,16 +27,16 @@ import { useHistory, useLocation, Link } from "react-router-dom";
|
||||
import classNames from "classnames";
|
||||
import styled from "styled-components";
|
||||
import { binder, ExtensionPoint } from "@scm-manager/ui-extensions";
|
||||
import { Branch, Repository } from "@scm-manager/ui-types";
|
||||
import { Branch, Repository, File } from "@scm-manager/ui-types";
|
||||
import Icon from "./Icon";
|
||||
import Tooltip from "./Tooltip";
|
||||
import copyToClipboard from "./CopyToClipboard";
|
||||
import { withContextPath } from "./urls";
|
||||
import { urls } from "@scm-manager/ui-api";
|
||||
|
||||
type Props = {
|
||||
repository: Repository;
|
||||
branch: Branch;
|
||||
defaultBranch: Branch;
|
||||
branch?: Branch;
|
||||
defaultBranch?: Branch;
|
||||
revision: string;
|
||||
path: string;
|
||||
baseUrl: string;
|
||||
@@ -53,6 +53,7 @@ const PermaLinkWrapper = styled.div`
|
||||
color: #dbdbdb;
|
||||
opacity: 0.75;
|
||||
}
|
||||
|
||||
&:hover i {
|
||||
color: #b5b5b5;
|
||||
opacity: 1;
|
||||
@@ -108,7 +109,7 @@ const Breadcrumb: FC<Props> = ({ repository, branch, defaultBranch, revision, pa
|
||||
}
|
||||
return (
|
||||
<li key={index}>
|
||||
<Link to={baseUrl + "/" + revision + "/" + currPath}>{pathFragment}</Link>
|
||||
<Link to={baseUrl + "/" + encodeURIComponent(revision) + "/" + currPath}>{pathFragment}</Link>
|
||||
</li>
|
||||
);
|
||||
});
|
||||
@@ -120,7 +121,7 @@ const Breadcrumb: FC<Props> = ({ repository, branch, defaultBranch, revision, pa
|
||||
history.push(location.pathname);
|
||||
setCopying(true);
|
||||
copyToClipboard(
|
||||
window.location.protocol + "//" + window.location.host + withContextPath(permalink || location.pathname)
|
||||
window.location.protocol + "//" + window.location.host + urls.withContextPath(permalink || location.pathname)
|
||||
).finally(() => setCopying(false));
|
||||
};
|
||||
|
||||
@@ -161,7 +162,7 @@ const Breadcrumb: FC<Props> = ({ repository, branch, defaultBranch, revision, pa
|
||||
branch: branch ? branch : defaultBranch,
|
||||
path,
|
||||
sources,
|
||||
repository,
|
||||
repository
|
||||
}}
|
||||
renderAll={true}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user