mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-19 07:54:23 +01:00
Refactor editor to update better
This commit is contained in:
@@ -1,10 +1,21 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useMount, useUnmount } from 'react-use';
|
||||
import { ButtonLink } from '../components/ButtonLink';
|
||||
import { Editor } from '../components/Editor';
|
||||
import { Heading } from '../components/Heading';
|
||||
import { VStack } from '../components/Stacks';
|
||||
import { useWorkspaces } from '../hooks/useWorkspaces';
|
||||
|
||||
export function Workspaces(props: { path: string }) {
|
||||
const workspaces = useWorkspaces();
|
||||
const [value, setValue] = useState<string>('hello wolrd');
|
||||
useUnmount(() => {
|
||||
console.log('UNMOUNT WORKSPACES');
|
||||
});
|
||||
useMount(() => {
|
||||
console.log('MOUNT WORKSPACES');
|
||||
});
|
||||
console.log('RENDER WORKSPACES');
|
||||
return (
|
||||
<VStack as="ul" className="p-12">
|
||||
<Heading>Workspaces</Heading>
|
||||
@@ -13,6 +24,7 @@ export function Workspaces(props: { path: string }) {
|
||||
{w.name}
|
||||
</ButtonLink>
|
||||
))}
|
||||
<Editor defaultValue={value} className="!bg-gray-50" onChange={setValue} />
|
||||
</VStack>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user