Skip to content

Commit

Permalink
fix: Cannot read properties of undefined (reading 'fields')
Browse files Browse the repository at this point in the history
  • Loading branch information
linonetwo committed Feb 4, 2024
1 parent 139062b commit a7b8672
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions src/tw-mobile-sync/server/TidGi-Mobile/server-sync-v1-endpoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,17 +96,18 @@ const handler: ServerEndpointHandler = function handler(request: Http.ClientRequ
} else if (new $tw.Tiddler(clientTiddlerField).fields.modified > serverTiddler.fields.modified) {
// Client tiddler is newer
context.wiki.addTiddler(clientTiddlerField);
} else {
// we should have covered all cases
console.log(
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
`Unhandled case: ${title} \nwhere ${String(new $tw.Tiddler(clientTiddlerField).fields.modified)} > ${serverTiddler?.fields?.modified} is ${
String(new $tw.Tiddler(clientTiddlerField).fields.modified > (serverTiddler?.fields?.modified ?? 0))
}`,
clientTiddlerField,
serverTiddler?.fields,
);
context.wiki.addTiddler(clientTiddlerField);
}
// we should have covered all cases
console.log(
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
`Unhandled case: ${title} \nwhere ${String(new $tw.Tiddler(clientTiddlerField).fields.modified)} > ${serverTiddler?.fields?.modified} is ${
new $tw.Tiddler(clientTiddlerField).fields.modified > serverTiddler.fields.modified
}`,
clientTiddlerField,
serverTiddler?.fields,
);
context.wiki.addTiddler(clientTiddlerField);
} catch (error) {
console.error('Error when processing tiddler', clientTiddlerField, error);
}
Expand Down

0 comments on commit a7b8672

Please sign in to comment.