Skip to content

Commit

Permalink
Merge pull request #17 from inngest/fix-issue-15
Browse files Browse the repository at this point in the history
fix: do not update state in render
  • Loading branch information
charlypoly authored Sep 30, 2024
2 parents 919ead6 + 5736c02 commit 77705cf
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 3,756 deletions.
5 changes: 5 additions & 0 deletions .changeset/sixty-cups-itch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@inngest/workflow-kit": patch
---

fix: do not update state in render
4 changes: 1 addition & 3 deletions examples/nextjs-blog-cms/components/automation-editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,7 @@ export const AutomationEditor = ({ workflow }: { workflow: Workflow }) => {
}}
>
<Editor>
<Sidebar position="right">
<></>
</Sidebar>
<Sidebar position="right" />
</Editor>
</Provider>
</div>
Expand Down
2 changes: 1 addition & 1 deletion examples/nextjs-blog-cms/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"lint": "next lint"
},
"dependencies": {
"@inngest/workflow-kit": "0.1.3-alpha-20240927112743-cfb6053c0cb7347670c83bb0edcd2edaedd11d9c",
"@inngest/workflow-kit": "0.1.3-alpha-20240930224141-9a7240323ec48bf95e5725173ab63ae424d76e6b",
"@mdx-js/mdx": "^3.0.1",
"@radix-ui/react-checkbox": "^1.1.1",
"@radix-ui/react-icons": "^1.3.0",
Expand Down
10 changes: 5 additions & 5 deletions examples/nextjs-blog-cms/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion packages/workflow/src/ui/sidebar/Sidebar.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { useEffect } from "react";
import { useProvider } from "../Provider";
import { SidebarWorkflowForm } from "./WorfklowForm";
import { SidebarFooter } from "./Footer";
Expand All @@ -20,7 +21,9 @@ export const Sidebar = (props: SidebarProps) => {

// Set this within context so the parent editor can adjust our
// flex layouts correctly.
setSidebarPosition(props.position === "left" ? "left" : "right");
useEffect(() => {
setSidebarPosition(props.position === "left" ? "left" : "right");
}, [props.position])

let content = props.children || useSidebarContent();

Expand Down
Loading

0 comments on commit 77705cf

Please sign in to comment.