Skip to content

Commit 342696d

Browse files
committed
fix(files): move useMemo above conditional return to fix Rules of Hooks
1 parent 5d7b4d9 commit 342696d

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/preview-panel.tsx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -247,16 +247,6 @@ const MarkdownPreview = memo(function MarkdownPreview({
247247

248248
checkboxCounterRef.current = 0
249249

250-
if (onCheckboxToggle) {
251-
return (
252-
<div ref={scrollRef} className='h-full overflow-auto p-6'>
253-
<ReactMarkdown remarkPlugins={REMARK_PLUGINS} components={components}>
254-
{content}
255-
</ReactMarkdown>
256-
</div>
257-
)
258-
}
259-
260250
const committedMarkdown = useMemo(
261251
() =>
262252
committed ? (
@@ -267,6 +257,16 @@ const MarkdownPreview = memo(function MarkdownPreview({
267257
[committed, components]
268258
)
269259

260+
if (onCheckboxToggle) {
261+
return (
262+
<div ref={scrollRef} className='h-full overflow-auto p-6'>
263+
<ReactMarkdown remarkPlugins={REMARK_PLUGINS} components={components}>
264+
{content}
265+
</ReactMarkdown>
266+
</div>
267+
)
268+
}
269+
270270
return (
271271
<div ref={scrollRef} className='h-full overflow-auto p-6'>
272272
{committedMarkdown}

0 commit comments

Comments
 (0)