From 9b46330c4dd7895957e01b20e4a0921c08e4f9cc Mon Sep 17 00:00:00 2001 From: theLAZYmd Date: Wed, 8 Apr 2020 00:02:20 +0100 Subject: [PATCH] load_pgn takes a pgn string, not a split array nowadays. Your lib is broken until that is fixed --- src/Viewer.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Viewer.js b/src/Viewer.js index 11de025..80fc54d 100644 --- a/src/Viewer.js +++ b/src/Viewer.js @@ -142,10 +142,11 @@ class Viewer extends React.Component { const pgnArray = pgnString.split(']') - chess.load_pgn(pgnArray[pgnArray.length - 1]) + chess.load_pgn(pgnString); for (let i=0;i < pgnArray.length - 2;i++) { - const headerInfo = pgnArray[i].trim().split(' "') + const headerInfo = pgnArray[i].trim().split(' "'); + if (!headerInfo[1]) continue; chess.header(headerInfo[0].replace(/\"/g, ''), headerInfo[1].replace(/\"/g, '')) }