Skip to content

fix: Update lint package and address warnings - #389

Open
lornakelly wants to merge 4 commits into
open-workflow-specification:mainfrom
lornakelly:365/fix-lint-package
Open

fix: Update lint package and address warnings#389
lornakelly wants to merge 4 commits into
open-workflow-specification:mainfrom
lornakelly:365/fix-lint-package

Conversation

@lornakelly

@lornakelly lornakelly commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

Summary

Closes #365

Updates the oxlint package which had breaking changes . Added fixes for relevant warnings

Changes

  • Disabled linter on shadcn components which are generated (tested updating components but fix still not available so will wait until fixed upstream)
  • Refactored to use useSyncExternalStore instead of useState + useEffect for proper external store subscription handling (system colour scheme media query)
  • Moved stateRef and isReadOnlyRef assignments to useEffect
  • DiagramEditorContextProvider.tsx:
    • Replaced useEffect for locale sync with direct state update during render
    • Moved selectedNodeIdRef assignment to useEffect
    • Added temporary oxlint-disable comment for setErrors in useEffect (will be addressed in editing feature branch)

Useful docs for ref:

Signed-off-by: lornakelly <lornakelly88@gmail.com>
Signed-off-by: lornakelly <lornakelly88@gmail.com>
Signed-off-by: lornakelly <lornakelly88@gmail.com>
Copilot AI lite review requested due to automatic review settings September 4, 2026 13:35
@netlify

netlify Bot commented Sep 4, 2026

Copy link
Copy Markdown

Deploy Preview for openworkflow-editor ready!

Name Link
🔨 Latest commit 3c4c7f8
🔍 Latest deploy log https://app.netlify.com/projects/openworkflow-editor/deploys/6a9add964ed1850008afab2a
😎 Deploy Preview https://deploy-preview-389--openworkflow-editor.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

It introduces render-phase state updates for locale syncing and a likely-incorrect render-count assertion, both of which can cause unstable behavior/tests under React’s rendering model.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR updates the repository’s oxlint version and adjusts React code/tests to satisfy new lint rules and warnings introduced by the upgrade (including React hook/purity-related rules), while keeping the diagram editor behavior consistent.

Changes:

  • Bump oxlint from ^1.77.0 to ^1.80.0 and update the lockfile accordingly.
  • Refactor some React internals (refs/state synchronization) and the useResolvedColorMode hook to align with updated lint expectations.
  • Update diagram editor store and hook tests to match the new behavior/implementation.
File summaries
File Description
pnpm-workspace.yaml Updates the workspace catalog oxlint version.
pnpm-lock.yaml Regenerates lockfile entries for the new oxlint version.
packages/open-workflow-diagram-editor/tests/store/DiagramEditorContextProvider.test.tsx Updates render-count assertions to use a spy instead of DOM text.
packages/open-workflow-diagram-editor/tests/hooks/useResolvedColorMode.test.ts Adjusts tests to reflect the new external-store subscription behavior.
packages/open-workflow-diagram-editor/src/store/DiagramEditorContextProvider.tsx Changes locale syncing strategy and ref updates related to content seeding.
packages/open-workflow-diagram-editor/src/react-flow/hooks/useWorkflowHistory.ts Moves ref assignments into an effect for lint compliance.
packages/open-workflow-diagram-editor/src/react-flow/diagram/Diagram.tsx Moves multiple ref assignments into an effect for lint compliance.
packages/open-workflow-diagram-editor/src/hooks/useResolvedColorMode.ts Refactors to useSyncExternalStore for media-query subscription correctness.
packages/open-workflow-diagram-editor/src/components/ui/tooltip.tsx Adds an oxlint suppression for a setState-in-effect pattern.
packages/open-workflow-diagram-editor/src/components/ui/sidebar.tsx Adds an oxlint suppression for an intentional impurity (Math.random) in useMemo.
Review details

Files not reviewed (1)

  • pnpm-lock.yaml: Generated file

Suppressed comments (1)

packages/open-workflow-diagram-editor/src/store/DiagramEditorContextProvider.tsx:110

  • Typo in comment: "implemntation" (and missing space in "asthe").
    // This will be addressed in the editing feature branch asthe implemntation is changing
  • Files reviewed: 10/11 changed files
  • Comments generated: 6
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread packages/open-workflow-diagram-editor/src/hooks/useResolvedColorMode.ts Outdated
Comment thread packages/open-workflow-diagram-editor/src/react-flow/diagram/Diagram.tsx Outdated
Comment thread packages/open-workflow-diagram-editor/src/react-flow/hooks/useWorkflowHistory.ts Outdated
Comment thread pnpm-workspace.yaml
Copilot AI review requested due to automatic review settings September 4, 2026 13:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Ref synchronization moved to passive effects can cause stale reads in async post-layout/timer logic, and there are also correctness/clarity issues in updated comments.

Review details

Files not reviewed (1)

  • pnpm-lock.yaml: Generated file

Suppressed comments (4)

Previously missed (3) — in code that hasn't changed since the last review.

packages/open-workflow-diagram-editor/src/react-flow/diagram/Diagram.tsx:94

  • The ref-sync happens in a passive effect, but these refs are read from a zero-delay setTimeout scheduled in another effect; a rerender between scheduling and the timeout firing can leave the timeout reading stale values (selection/viewport/submitModel). Use a layout effect (or keep the render-time assignment) so refs are updated synchronously after each commit.
    packages/open-workflow-diagram-editor/src/react-flow/hooks/useWorkflowHistory.ts:100
  • Updating stateRef/isReadOnlyRef in a passive effect can leave callbacks reading stale values if they run before effects flush (e.g., immediately after mount/commit). A layout effect keeps render pure while ensuring these refs are current before user events and other effects run.
    packages/open-workflow-diagram-editor/src/store/DiagramEditorContextProvider.tsx:111
  • Typo in comment text ("asthe" / "implemntation").

packages/open-workflow-diagram-editor/tests/store/DiagramEditorContextProvider.test.tsx:116

  • The render-cycle comment is now inconsistent with the assertion (it says 4 cycles, but the test expects 3). Update the comment so future readers understand the expected behavior.
    // 4 rendering cycles are expected:
    // 1- initial render, 2- history seed useEffect,
    // 3- forced by rerender
    expect(renderSpy).toHaveBeenCalledTimes(3);
  • Files reviewed: 10/11 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

Copilot AI review requested due to automatic review settings September 4, 2026 14:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

It introduces a non-deterministic render path (Math.random) and includes a couple of fixable correctness/quality issues (missing effect deps and a typo) that should be addressed before approval.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details

Files not reviewed (1)

  • pnpm-lock.yaml: Generated file
  • Files reviewed: 10/11 changed files
  • Comments generated: 3
  • Review effort level: Lite

Comment thread packages/open-workflow-diagram-editor/src/components/ui/sidebar.tsx
Comment thread packages/open-workflow-diagram-editor/src/store/DiagramEditorContextProvider.tsx Outdated
Signed-off-by: lornakelly <lornakelly88@gmail.com>
Copilot AI review requested due to automatic review settings September 4, 2026 15:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The new passive useEffect ref-sync in Diagram.tsx can race with fast async layout callbacks and lead to stale ref reads at runtime.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details

Files not reviewed (1)

  • pnpm-lock.yaml: Generated file

Suppressed comments (1)

packages/open-workflow-diagram-editor/src/store/DiagramEditorContextProvider.tsx:110

  • Typo in comment: "implemntation" → "implementation".
    // This will be addressed in the editing feature branch as the implemntation is changing
  • Files reviewed: 10/11 changed files
  • Comments generated: 1
  • Review effort level: Lite

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.

bug: Investigate and fix linting errors

2 participants