Repository navigation
Relint codemirror on schema update - #710
anderson4j wants to merge 2 commits into
Conversation
96e2b3e to
cc31477
Compare
🦋 Changeset detectedLatest commit: ba3ab50 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
cc31477 to
903b495
Compare
| { | ||
| needsRefresh: (update) => | ||
| update.transactions.some((tr) => | ||
| tr.effects.some((effect) => effect.is(schemaUpdated)), | ||
| ), | ||
| }, |
There was a problem hiding this comment.
this is the new check added to the existing cypherLinter extension of the codemirror to retrigger lint on schema update.
| workerTerminateTimeout: 2000, | ||
| }); | ||
|
|
||
| export const cypherLinter: (config: CypherConfig) => Extension = (config) => |
There was a problem hiding this comment.
Lots of "diff" inside cypherLinter, but actually the second argument commented on below is the only change, the rest is formatting
| * Compared by reference to decide when the document needs relinting: | ||
| * Avoid passing a new object when nothing changed | ||
| * as that would relint on every poll for no reason. | ||
| * | ||
| * @type {DbSchema} | ||
| */ |
There was a problem hiding this comment.
The way I've seen this handled in the past, is that you add a version number to the schema. So you say version: 1. Then when you've fetched the server, you do the deep compare once, if there's any difference, you increment the verion number. This means there's no risk or re-running more often than our polling interval.
Everything downstream just checks what the last schema version used was
Adds a "needsRefresh" check to react-codemirror linter, that gets triggered when schema is updated. (Checks by object equality, not deep equality)
Has a corresponding PR in upx that will update codemirror to use this change, and prevent the passing of a new schema object when the old schema is identical to the new
Closes LS-203