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

clientfirst #19

Merged
merged 5 commits into from
Apr 14, 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
2 changes: 1 addition & 1 deletion imports/cyto/graph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export default function CytoGraph({
useCytoViewport: _useCytoViewport = useState,
useSpaceId: _useSpaceId = useSpaceId,
}: CytoGraphProps){
console.log('https://github.com/deep-foundation/deepcase-app/issues/236', 'CytoGraph', 'links', links);
// console.log('https://github.com/deep-foundation/deepcase-app/issues/236', 'CytoGraph', 'links', links);
const deep = useDeep();
const __cytoViewportRef = useRefstarter<{ pan: { x: number; y: number; }; zoom: number }>();
const cytoViewportRef = _cytoViewportRef || __cytoViewportRef;
Expand Down
4 changes: 2 additions & 2 deletions imports/cyto/hooks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ export function useLinkReactElements(elements = [], reactElements = [], cy, ml,
// // 'border-width': 0,
// // });
// }
if (await isOpened(id)) {
if (isOpened(id)) {
await close(id);
} else {
const { data: handler } = await deep.select({
Expand Down Expand Up @@ -803,7 +803,7 @@ export function useCyInitializer({
// // return element object to be passed to cy.add() for edge
// return {};
// },
hoverDelay: 150, // time spent hovering over a target node before it is considered selected
hoverDelay: 0, // time spent hovering over a target node before it is considered selected
snap: true, // when enabled, the edge can be drawn by just moving close to a target node (can be confusing on compound graphs)
snapThreshold: 0, // the target node must be less than or equal to this many pixels away from the cursor/finger
snapFrequency: 15, // the number of times per second (Hz) that snap checks done (lower is less expensive)
Expand Down
8 changes: 4 additions & 4 deletions imports/cyto/opened.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useMemo } from "react";
export function useOpenedMethods(): {
open: (id: number, handlerId: number) => void;
close: (id: number) => void;
isOpened: (id: number) => Promise<boolean>;
isOpened: (id: number) => boolean;
} {
const [spaceId] = useSpaceId();
const spaceIdRef = useRefAutofill(spaceId);
Expand All @@ -17,16 +17,16 @@ export function useOpenedMethods(): {
OpenedHandler = await deep.id('@deep-foundation/deepcase-opened', 'OpenedHandler');
})();
return {
isOpened: async (id) => {
const q = await deep.select({
isOpened: (id) => {
const q = deep.minilinks.query({
type_id: OpenedHandler,
from: {
type_id: Opened,
from_id: spaceIdRef.current,
to_id: id,
},
});
const openedHandler = q?.data?.[0];
const openedHandler = q?.[0];
return !!openedHandler
},
close: async (id) => {
Expand Down
2 changes: 1 addition & 1 deletion imports/cyto/react.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export const CytoReactLayout = React.memo(function CytoReactLayout({
stl.msTransform = val;
stl.transform = val;
}
cy.$(`#id`).style({ });
cy.$(`#${id}`).style({ });
}
}

Expand Down
12 changes: 7 additions & 5 deletions imports/loader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ export const DeepLoaderActive = React.memo(function DeepLoaderActive({
const deep = useDeep();
const subQuery = useMemo(() => {
const v = (queryLink?.value?.value);
const variables = deep.serializeQuery(v);
// @ts-ignore
const variables = deep.serializeQuery(v, 'links', deep?.unvertualizeId);
const where = variables?.where;
return generateQuery({
operation: subscription ? 'subscription' : 'query',
Expand Down Expand Up @@ -288,7 +289,8 @@ export const DeepLoader = memo(function DeepLoader({
return { value: { value: {
down: {
tree_id: { _eq: deep.idLocal('@deep-foundation/core', 'typesTree') },
link_id: { _in: ids }
link_id: { _in: ids },
parent_id: { _nin: ids },
},
} } };
}, [ids]);
Expand Down Expand Up @@ -401,11 +403,11 @@ export const DeepLoader = memo(function DeepLoader({
}, [])}
/></>
{queries?.map((f, i) => (f?.value?.value ? <DeepLoaderActive
key={`DEEPCASE_QUERY_${f.id}`}
name={`DEEPCASE_QUERY_${f.id}`}
key={`DEEPCASE_QUERY_${`${f.id}`.replace('-', 'virtual')}`}
name={`DEEPCASE_QUERY_${`${f.id}`.replace('-', 'virtual')}`}
query={f}
onChange={queryChanged}
/> : <React.Fragment key={`DEEPCASE_QUERY_${f.id}`}/>))}
/> : <React.Fragment key={`DEEPCASE_QUERY_${`${f.id}`.replace('-', 'virtual')}`}/>))}
<><DeepLoaderActive
key={`DEEPCASE_TYPES`}
name={`DEEPCASE_TYPES`}
Expand Down
Loading