Skip to content

Relint codemirror on schema update - #710

Open
anderson4j wants to merge 2 commits into
mainfrom
relintOnSchemaUpdate
Open

anderson4j wants to merge 2 commits into
mainfrom
relintOnSchemaUpdate

Conversation

@anderson4j

@anderson4j anderson4j commented Jul 17, 2026 •

Copy link
Copy Markdown
Collaborator

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

@anderson4j
anderson4j force-pushed the relintOnSchemaUpdate branch from 96e2b3e to cc31477 Compare August 11, 2026 09:36
@changeset-bot

changeset-bot Bot commented Aug 11, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: ba3ab50

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@neo4j-cypher/react-codemirror Patch
@neo4j-cypher/react-codemirror-playground Patch

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

@anderson4j
anderson4j force-pushed the relintOnSchemaUpdate branch from cc31477 to 903b495 Compare August 11, 2026 11:46
Comment on lines +78 to +83
{
needsRefresh: (update) =>
update.transactions.some((tr) =>
tr.effects.some((effect) => effect.is(schemaUpdated)),
),
},

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) =>

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lots of "diff" inside cypherLinter, but actually the second argument commented on below is the only change, the rest is formatting

@anderson4j anderson4j changed the title (WIP) Relint on schema update Relint on schema update Aug 14, 2026
@anderson4j
anderson4j marked this pull request as ready for review August 14, 2026 07:17
@anderson4j anderson4j changed the title Relint on schema update Relint codemirror on schema update Aug 14, 2026
Comment on lines +138 to 143
* 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}
*/

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants