Skip to content

Commit 5e96d37

Browse files
committed
fix(gitGraph): refresh config on each render to ensure latest settings are applied
1 parent 665cb90 commit 5e96d37

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/mermaid/src/diagrams/git/gitGraphRenderer.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ interface CommitPositionOffset extends CommitPosition {
2121
posWithOffset: number;
2222
}
2323

24-
const DEFAULT_CONFIG = getConfig();
25-
const DEFAULT_GITGRAPH_CONFIG = DEFAULT_CONFIG?.gitGraph;
24+
let DEFAULT_GITGRAPH_CONFIG = getConfig()?.gitGraph;
2625
const LAYOUT_OFFSET = 10;
2726
const COMMIT_STEP = 40;
2827
const PX = 4;
@@ -898,6 +897,9 @@ const setBranchPosition = function (
898897
export const draw: DrawDefinition = function (txt, id, ver, diagObj) {
899898
clear();
900899

900+
// Refresh gitGraph config so each render sees the latest mermaid config
901+
DEFAULT_GITGRAPH_CONFIG = getConfig()?.gitGraph;
902+
901903
log.debug('in gitgraph renderer', txt + '\n', 'id:', id, ver);
902904
if (!DEFAULT_GITGRAPH_CONFIG) {
903905
throw new Error('GitGraph config not found');

0 commit comments

Comments
 (0)