Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: do not update state in render #17

Merged
merged 3 commits into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading