File tree 1 file changed +8
-2
lines changed
site/src/components/Workspace 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change 1
1
import { makeStyles } from "@material-ui/core/styles"
2
- import { FC } from "react"
2
+ import React , { FC } from "react"
3
3
import { useNavigate } from "react-router-dom"
4
4
import * as TypesGen from "../../api/typesGenerated"
5
5
import { BuildsTable } from "../BuildsTable/BuildsTable"
@@ -14,6 +14,12 @@ import { WorkspaceScheduleButton } from "../WorkspaceScheduleButton/WorkspaceSch
14
14
import { WorkspaceSection } from "../WorkspaceSection/WorkspaceSection"
15
15
import { WorkspaceStats } from "../WorkspaceStats/WorkspaceStats"
16
16
17
+ // The WorkspaceScheduleButton does some calculation to display the date labels
18
+ // so to avoid doing that every seconds - because of the workspace pooling - we
19
+ // are memoizing this component. More details:
20
+ // https://github.com/coder/coder/pull/2775#discussion_r912080377
21
+ const MemoizedWorkspaceScheduleButton = React . memo ( WorkspaceScheduleButton )
22
+
17
23
export interface WorkspaceProps {
18
24
bannerProps : {
19
25
isLoading ?: boolean
@@ -60,7 +66,7 @@ export const Workspace: FC<WorkspaceProps> = ({
60
66
< PageHeader
61
67
actions = {
62
68
< Stack direction = "row" spacing = { 1 } >
63
- < WorkspaceScheduleButton
69
+ < MemoizedWorkspaceScheduleButton
64
70
workspace = { workspace }
65
71
onDeadlineMinus = { scheduleProps . onDeadlineMinus }
66
72
onDeadlinePlus = { scheduleProps . onDeadlinePlus }
You can’t perform that action at this time.
0 commit comments