@teambit/graph 1.0.316 → 1.0.318

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/artifacts/__bit_junit.xml +1 -1
  2. package/artifacts/preview/teambit_component_graph-preview.js +1 -1
  3. package/artifacts/schema.json +281 -172
  4. package/dist/graph.graphql.js +3 -2
  5. package/dist/graph.graphql.js.map +1 -1
  6. package/dist/{preview-1719372071684.js → preview-1719544843434.js} +2 -2
  7. package/dist/ui/component-node/component-node.js +6 -7
  8. package/dist/ui/component-node/component-node.js.map +1 -1
  9. package/dist/ui/dependencies-compare/compare-node-model.d.ts +1 -1
  10. package/dist/ui/dependencies-compare/compare-node-model.js.map +1 -1
  11. package/dist/ui/dependencies-compare/dependency-compare-node.js +7 -4
  12. package/dist/ui/dependencies-compare/dependency-compare-node.js.map +1 -1
  13. package/dist/ui/dependencies-compare/diff-graph.js +4 -4
  14. package/dist/ui/dependencies-compare/diff-graph.js.map +1 -1
  15. package/dist/ui/dependencies-graph/calc-elements.js +2 -2
  16. package/dist/ui/dependencies-graph/calc-elements.js.map +1 -1
  17. package/dist/ui/dependencies-graph/dependencies-graph.d.ts +3 -2
  18. package/dist/ui/dependencies-graph/dependencies-graph.js +30 -12
  19. package/dist/ui/dependencies-graph/dependencies-graph.js.map +1 -1
  20. package/dist/ui/graph-page/graph-filters.d.ts +1 -0
  21. package/dist/ui/graph-page/graph-filters.js.map +1 -1
  22. package/dist/ui/graph-page/graph-page.js +18 -19
  23. package/dist/ui/graph-page/graph-page.js.map +1 -1
  24. package/dist/ui/graph-page/graph-page.module.scss +3 -1
  25. package/dist/ui/graph.section.js +3 -3
  26. package/dist/ui/graph.section.js.map +1 -1
  27. package/dist/ui/query/get-graph.query.d.ts +2 -1
  28. package/dist/ui/query/get-graph.query.js +15 -3
  29. package/dist/ui/query/get-graph.query.js.map +1 -1
  30. package/dist/ui/query/node-model.d.ts +3 -2
  31. package/dist/ui/query/node-model.js +3 -1
  32. package/dist/ui/query/node-model.js.map +1 -1
  33. package/dist/ui/query/use-graph-query.d.ts +2 -1
  34. package/dist/ui/query/use-graph-query.js +43 -14
  35. package/dist/ui/query/use-graph-query.js.map +1 -1
  36. package/dist/ui/query/use-graph.d.ts +2 -0
  37. package/package.json +13 -15
  38. package/ui/component-node/component-node.tsx +6 -5
  39. package/ui/dependencies-compare/compare-node-model.ts +1 -1
  40. package/ui/dependencies-compare/dependency-compare-node.tsx +4 -4
  41. package/ui/dependencies-compare/diff-graph.ts +5 -4
  42. package/ui/dependencies-graph/calc-elements.tsx +2 -2
  43. package/ui/dependencies-graph/dependencies-graph.tsx +29 -10
  44. package/ui/graph-page/graph-filters.tsx +1 -0
  45. package/ui/graph-page/graph-page.module.scss +3 -1
  46. package/ui/graph-page/graph-page.tsx +17 -15
  47. package/ui/graph.section.tsx +3 -3
  48. package/ui/query/get-graph.query.ts +15 -5
  49. package/ui/query/node-model.ts +5 -3
  50. package/ui/query/use-graph-query.ts +53 -11
@@ -11,13 +11,6 @@ function _react() {
11
11
  };
12
12
  return data;
13
13
  }
14
- function _documenterUi() {
15
- const data = require("@teambit/documenter.ui.heading");
16
- _documenterUi = function () {
17
- return data;
18
- };
19
- return data;
20
- }
21
14
  function _designUiPages() {
22
15
  const data = require("@teambit/design.ui.pages.not-found");
23
16
  _designUiPages = function () {
@@ -39,9 +32,16 @@ function _component() {
39
32
  };
40
33
  return data;
41
34
  }
42
- function _uiFoundationUi() {
43
- const data = require("@teambit/ui-foundation.ui.full-loader");
44
- _uiFoundationUi = function () {
35
+ function _designSkeletons() {
36
+ const data = require("@teambit/design.skeletons.base-skeleton");
37
+ _designSkeletons = function () {
38
+ return data;
39
+ };
40
+ return data;
41
+ }
42
+ function _classnames() {
43
+ const data = _interopRequireDefault(require("classnames"));
44
+ _classnames = function () {
45
45
  return data;
46
46
  };
47
47
  return data;
@@ -88,22 +88,21 @@ function GraphPage({
88
88
  const {
89
89
  graph,
90
90
  error,
91
+ graphLoading,
91
92
  loading
92
93
  } = (0, _query().useGraphQuery)([component.id.toString()], filter);
93
- if (error) return error.code === 404 ? /*#__PURE__*/_react().default.createElement(_designUiPages().NotFoundPage, null) : /*#__PURE__*/_react().default.createElement(_designUiPages2().ServerErrorPage, null);
94
- if (!graph) return /*#__PURE__*/_react().default.createElement(_uiFoundationUi().FullLoader, null);
95
94
  const isFiltered = filter === 'runtimeOnly';
95
+ if (error) return error.code === 404 ? /*#__PURE__*/_react().default.createElement(_designUiPages().NotFoundPage, null) : /*#__PURE__*/_react().default.createElement(_designUiPages2().ServerErrorPage, null);
96
96
  return /*#__PURE__*/_react().default.createElement("div", {
97
- className: _graphPageModule().default.page
98
- }, /*#__PURE__*/_react().default.createElement(_documenterUi().H2, {
99
- size: "xs"
100
- }, "Component Dependencies"), /*#__PURE__*/_react().default.createElement(_dependenciesGraph().DependenciesGraph, {
97
+ className: (0, _classnames().default)(_graphPageModule().default.page)
98
+ }, /*#__PURE__*/_react().default.createElement(_dependenciesGraph().DependenciesGraph, {
101
99
  componentWidgets: componentWidgets,
102
100
  graph: graph,
103
101
  rootNode: component.id,
104
- className: _graphPageModule().default.graph
105
- }, /*#__PURE__*/_react().default.createElement(_graphFilters().GraphFilters, {
106
- className: _graphPageModule().default.filters,
102
+ className: (0, _classnames().default)(_graphPageModule().default.graph, !graph && _designSkeletons().skeleton),
103
+ loadingGraphMetadata: graphLoading
104
+ }, graph && /*#__PURE__*/_react().default.createElement(_graphFilters().GraphFilters, {
105
+ className: (0, _classnames().default)(_graphPageModule().default.filters),
107
106
  disable: loading,
108
107
  isFiltered: isFiltered,
109
108
  onChangeFilter: onCheckFilter
@@ -1 +1 @@
1
- {"version":3,"names":["_react","data","_interopRequireWildcard","require","_documenterUi","_designUiPages","_designUiPages2","_component","_uiFoundationUi","_query","_dependenciesGraph","_graphFilters","_graphPageModule","_interopRequireDefault","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","GraphPage","componentWidgets","component","useContext","ComponentContext","filter","setFilter","useState","onCheckFilter","isFiltered","undefined","graph","error","loading","useGraphQuery","id","toString","code","createElement","NotFoundPage","ServerErrorPage","FullLoader","className","styles","page","H2","size","DependenciesGraph","rootNode","GraphFilters","filters","disable","onChangeFilter"],"sources":["graph-page.tsx"],"sourcesContent":["import React, { useContext, useState } from 'react';\n\nimport { H2 } from '@teambit/documenter.ui.heading';\nimport { NotFoundPage } from '@teambit/design.ui.pages.not-found';\nimport { ServerErrorPage } from '@teambit/design.ui.pages.server-error';\nimport { ComponentContext } from '@teambit/component';\nimport { FullLoader } from '@teambit/ui-foundation.ui.full-loader';\n\nimport { useGraphQuery } from '../query';\nimport { DependenciesGraph } from '../dependencies-graph';\nimport { ComponentWidgetSlot } from '../../graph.ui.runtime';\nimport type { GraphFilter } from '../../model/graph-filters';\n\nimport { GraphFilters } from './graph-filters';\n\nimport styles from './graph-page.module.scss';\n\ntype GraphPageProps = {\n componentWidgets: ComponentWidgetSlot;\n};\n\nexport function GraphPage({ componentWidgets }: GraphPageProps) {\n const component = useContext(ComponentContext);\n\n const [filter, setFilter] = useState<GraphFilter>('runtimeOnly');\n const onCheckFilter = (isFiltered: boolean) => {\n setFilter(isFiltered ? 'runtimeOnly' : undefined);\n };\n\n const { graph, error, loading } = useGraphQuery([component.id.toString()], filter);\n if (error) return error.code === 404 ? <NotFoundPage /> : <ServerErrorPage />;\n if (!graph) return <FullLoader />;\n\n const isFiltered = filter === 'runtimeOnly';\n\n return (\n <div className={styles.page}>\n <H2 size=\"xs\">Component Dependencies</H2>\n <DependenciesGraph\n componentWidgets={componentWidgets}\n graph={graph}\n rootNode={component.id}\n className={styles.graph}\n >\n <GraphFilters\n className={styles.filters}\n disable={loading}\n isFiltered={isFiltered}\n onChangeFilter={onCheckFilter}\n />\n </DependenciesGraph>\n </div>\n );\n}\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EA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AAQ,EAAE1B,SAAS,CAACa,EAAG;IACvBO,SAAS,EAAEC,0BAAM,CAACZ;EAAM,gBAExB7C,MAAA,GAAAgB,OAAA,CAAAoC,aAAA,CAACzC,aAAA,GAAAoD,YAAY;IACXP,SAAS,EAAEC,0BAAM,CAACO,OAAQ;IAC1BC,OAAO,EAAElB,OAAQ;IACjBJ,UAAU,EAAEA,UAAW;IACvBuB,cAAc,EAAExB;EAAc,CAC/B,CACgB,CAChB,CAAC;AAEV","ignoreList":[]}
1
+ {"version":3,"names":["_react","data","_interopRequireWildcard","require","_designUiPages","_designUiPages2","_component","_designSkeletons","_classnames","_interopRequireDefault","_query","_dependenciesGraph","_graphFilters","_graphPageModule","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","GraphPage","componentWidgets","component","useContext","ComponentContext","filter","setFilter","useState","onCheckFilter","isFiltered","undefined","graph","error","graphLoading","loading","useGraphQuery","id","toString","code","createElement","NotFoundPage","ServerErrorPage","className","classNames","styles","page","DependenciesGraph","rootNode","skeleton","loadingGraphMetadata","GraphFilters","filters","disable","onChangeFilter"],"sources":["graph-page.tsx"],"sourcesContent":["import React, { useContext, useState } from 'react';\nimport { NotFoundPage } from '@teambit/design.ui.pages.not-found';\nimport { ServerErrorPage } from '@teambit/design.ui.pages.server-error';\nimport { ComponentContext } from '@teambit/component';\nimport { skeleton } from '@teambit/design.skeletons.base-skeleton';\nimport classNames from 'classnames';\n\nimport { useGraphQuery } from '../query';\nimport { DependenciesGraph } from '../dependencies-graph';\nimport { ComponentWidgetSlot } from '../../graph.ui.runtime';\nimport type { GraphFilter } from '../../model/graph-filters';\n\nimport { GraphFilters } from './graph-filters';\n\nimport styles from './graph-page.module.scss';\n\ntype GraphPageProps = {\n componentWidgets: ComponentWidgetSlot;\n};\n\nexport function GraphPage({ componentWidgets }: GraphPageProps) {\n const component = useContext(ComponentContext);\n\n const [filter, setFilter] = useState<GraphFilter>('runtimeOnly');\n\n const onCheckFilter = (isFiltered: boolean) => {\n setFilter(isFiltered ? 'runtimeOnly' : undefined);\n };\n\n const { graph, error, graphLoading, loading } = useGraphQuery([component.id.toString()], filter);\n\n const isFiltered = filter === 'runtimeOnly';\n\n if (error) return error.code === 404 ? <NotFoundPage /> : <ServerErrorPage />;\n\n return (\n <div className={classNames(styles.page)}>\n <DependenciesGraph\n componentWidgets={componentWidgets}\n graph={graph}\n rootNode={component.id}\n className={classNames(styles.graph, !graph && skeleton)}\n loadingGraphMetadata={graphLoading}\n >\n {graph && (\n <GraphFilters\n className={classNames(styles.filters)}\n disable={loading}\n isFiltered={isFiltered}\n onChangeFilter={onCheckFilter}\n />\n )}\n </DependenciesGraph>\n </div>\n );\n}\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,uBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,eAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,cAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,gBAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,eAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,WAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,UAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,iBAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,gBAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,YAAA;EAAA,MAAAP,IAAA,GAAAQ,sBAAA,CAAAN,OAAA;EAAAK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,gBAAGtD,MAAA,GAAAgB,OAAA,CAAAqC,aAAA,CAAChD,eAAA,GAAAkD,eAAe,MAAE,CAAC;EAE7E,oBACEvD,MAAA,GAAAgB,OAAA,CAAAqC,aAAA;IAAKG,SAAS,EAAE,IAAAC,qBAAU,EAACC,0BAAM,CAACC,IAAI;EAAE,gBACtC3D,MAAA,GAAAgB,OAAA,CAAAqC,aAAA,CAAC1C,kBAAA,GAAAiD,iBAAiB;IAChBzB,gBAAgB,EAAEA,gBAAiB;IACnCU,KAAK,EAAEA,KAAM;IACbgB,QAAQ,EAAEzB,SAAS,CAACc,EAAG;IACvBM,SAAS,EAAE,IAAAC,qBAAU,EAACC,0BAAM,CAACb,KAAK,EAAE,CAACA,KAAK,IAAIiB,2BAAQ,CAAE;IACxDC,oBAAoB,EAAEhB;EAAa,GAElCF,KAAK,iBACJ7C,MAAA,GAAAgB,OAAA,CAAAqC,aAAA,CAACzC,aAAA,GAAAoD,YAAY;IACXR,SAAS,EAAE,IAAAC,qBAAU,EAACC,0BAAM,CAACO,OAAO,CAAE;IACtCC,OAAO,EAAElB,OAAQ;IACjBL,UAAU,EAAEA,UAAW;IACvBwB,cAAc,EAAEzB;EAAc,CAC/B,CAEc,CAChB,CAAC;AAEV","ignoreList":[]}
@@ -28,7 +28,9 @@
28
28
  top: 8px;
29
29
  right: 8px;
30
30
  padding: 8px;
31
-
31
+ display: flex;
32
+ flex-direction: column;
33
+ gap: 8px;
32
34
  font-size: 0.75em;
33
35
  box-shadow: var(--bit-shadow-faint);
34
36
  z-index: 8; // position above the abs positioned graph items
@@ -26,14 +26,14 @@ class GraphSection {
26
26
  constructor(componentWidgetSlot) {
27
27
  this.componentWidgetSlot = componentWidgetSlot;
28
28
  _defineProperty(this, "route", {
29
- path: '~dependencies',
29
+ path: '~graph',
30
30
  element: /*#__PURE__*/_react().default.createElement(_graphPage().GraphPage, {
31
31
  componentWidgets: this.componentWidgetSlot
32
32
  })
33
33
  });
34
34
  _defineProperty(this, "navigationLink", {
35
- href: '~dependencies',
36
- children: 'Dependencies'
35
+ href: '~graph',
36
+ children: 'Graph'
37
37
  });
38
38
  _defineProperty(this, "order", 40);
39
39
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_react","data","_interopRequireDefault","require","_graphPage","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","GraphSection","constructor","componentWidgetSlot","path","element","createElement","GraphPage","componentWidgets","href","children","exports"],"sources":["graph.section.tsx"],"sourcesContent":["import { Section } from '@teambit/component';\nimport React from 'react';\n\nimport { GraphPage } from './graph-page';\nimport { ComponentWidgetSlot } from '../graph.ui.runtime';\n\nexport class GraphSection implements Section {\n constructor(private componentWidgetSlot: ComponentWidgetSlot) {}\n\n route = {\n path: '~dependencies',\n element: <GraphPage componentWidgets={this.componentWidgetSlot} />,\n };\n navigationLink = {\n href: '~dependencies',\n children: 'Dependencies',\n };\n order = 40;\n}\n"],"mappings":";;;;;;AACA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAG,WAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,UAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAyC,SAAAC,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,gBAAAH,CAAA,EAAAI,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAJ,CAAA,GAAAO,MAAA,CAAAC,cAAA,CAAAR,CAAA,EAAAI,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAAA,MAAAC,QAAA,UAAAZ,CAAA,CAAAI,CAAA,IAAAC,CAAA,EAAAL,CAAA;AAAA,SAAAM,eAAAD,CAAA,QAAAQ,CAAA,GAAAC,YAAA,CAAAT,CAAA,uCAAAQ,CAAA,GAAAA,CAAA,GAAAA,CAAA;AAAA,SAAAC,aAAAT,CAAA,EAAAD,CAAA,2BAAAC,CAAA,KAAAA,CAAA,SAAAA,CAAA,MAAAL,CAAA,GAAAK,CAAA,CAAAU,MAAA,CAAAC,WAAA,kBAAAhB,CAAA,QAAAa,CAAA,GAAAb,CAAA,CAAAiB,IAAA,CAAAZ,CAAA,EAAAD,CAAA,uCAAAS,CAAA,SAAAA,CAAA,YAAAK,SAAA,yEAAAd,CAAA,GAAAe,MAAA,GAAAC,MAAA,EAAAf,CAAA;AAGlC,MAAMgB,YAAY,CAAoB;EAC3CC,WAAWA,CAASC,mBAAwC,EAAE;IAAA,KAA1CA,mBAAwC,GAAxCA,mBAAwC;IAAApB,eAAA,gBAEpD;MACNqB,IAAI,EAAE,eAAe;MACrBC,OAAO,eAAE9B,MAAA,GAAAO,OAAA,CAAAwB,aAAA,CAAC3B,UAAA,GAAA4B,SAAS;QAACC,gBAAgB,EAAE,IAAI,CAACL;MAAoB,CAAE;IACnE,CAAC;IAAApB,eAAA,yBACgB;MACf0B,IAAI,EAAE,eAAe;MACrBC,QAAQ,EAAE;IACZ,CAAC;IAAA3B,eAAA,gBACO,EAAE;EAVqD;AAWjE;AAAC4B,OAAA,CAAAV,YAAA,GAAAA,YAAA","ignoreList":[]}
1
+ {"version":3,"names":["_react","data","_interopRequireDefault","require","_graphPage","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","GraphSection","constructor","componentWidgetSlot","path","element","createElement","GraphPage","componentWidgets","href","children","exports"],"sources":["graph.section.tsx"],"sourcesContent":["import { Section } from '@teambit/component';\nimport React from 'react';\n\nimport { GraphPage } from './graph-page';\nimport { ComponentWidgetSlot } from '../graph.ui.runtime';\n\nexport class GraphSection implements Section {\n constructor(private componentWidgetSlot: ComponentWidgetSlot) {}\n\n route = {\n path: '~graph',\n element: <GraphPage componentWidgets={this.componentWidgetSlot} />,\n };\n navigationLink = {\n href: '~graph',\n children: 'Graph',\n };\n order = 40;\n}\n"],"mappings":";;;;;;AACA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAG,WAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,UAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAyC,SAAAC,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,gBAAAH,CAAA,EAAAI,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAJ,CAAA,GAAAO,MAAA,CAAAC,cAAA,CAAAR,CAAA,EAAAI,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAAA,MAAAC,QAAA,UAAAZ,CAAA,CAAAI,CAAA,IAAAC,CAAA,EAAAL,CAAA;AAAA,SAAAM,eAAAD,CAAA,QAAAQ,CAAA,GAAAC,YAAA,CAAAT,CAAA,uCAAAQ,CAAA,GAAAA,CAAA,GAAAA,CAAA;AAAA,SAAAC,aAAAT,CAAA,EAAAD,CAAA,2BAAAC,CAAA,KAAAA,CAAA,SAAAA,CAAA,MAAAL,CAAA,GAAAK,CAAA,CAAAU,MAAA,CAAAC,WAAA,kBAAAhB,CAAA,QAAAa,CAAA,GAAAb,CAAA,CAAAiB,IAAA,CAAAZ,CAAA,EAAAD,CAAA,uCAAAS,CAAA,SAAAA,CAAA,YAAAK,SAAA,yEAAAd,CAAA,GAAAe,MAAA,GAAAC,MAAA,EAAAf,CAAA;AAGlC,MAAMgB,YAAY,CAAoB;EAC3CC,WAAWA,CAASC,mBAAwC,EAAE;IAAA,KAA1CA,mBAAwC,GAAxCA,mBAAwC;IAAApB,eAAA,gBAEpD;MACNqB,IAAI,EAAE,QAAQ;MACdC,OAAO,eAAE9B,MAAA,GAAAO,OAAA,CAAAwB,aAAA,CAAC3B,UAAA,GAAA4B,SAAS;QAACC,gBAAgB,EAAE,IAAI,CAACL;MAAoB,CAAE;IACnE,CAAC;IAAApB,eAAA,yBACgB;MACf0B,IAAI,EAAE,QAAQ;MACdC,QAAQ,EAAE;IACZ,CAAC;IAAA3B,eAAA,gBACO,EAAE;EAVqD;AAWjE;AAAC4B,OAAA,CAAAV,YAAA,GAAAA,YAAA","ignoreList":[]}
@@ -1,4 +1,5 @@
1
1
  import { EdgeType } from '../../edge-type';
2
+ export declare const GET_GRAPH_IDS: import("@apollo/client").DocumentNode;
2
3
  export declare const GET_GRAPH: import("@apollo/client").DocumentNode;
3
4
  export type RawGraphQuery = {
4
5
  graph: RawGraph;
@@ -9,7 +10,7 @@ export type RawGraph = {
9
10
  };
10
11
  export type RawNode = {
11
12
  id: string;
12
- component: {
13
+ component?: {
13
14
  id: {
14
15
  name: string;
15
16
  scope: string;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.GET_GRAPH = void 0;
6
+ exports.GET_GRAPH_IDS = exports.GET_GRAPH = void 0;
7
7
  function _client() {
8
8
  const data = require("@apollo/client");
9
9
  _client = function () {
@@ -11,8 +11,20 @@ function _client() {
11
11
  };
12
12
  return data;
13
13
  }
14
- // please update types when updating query, for added safety
15
-
14
+ const GET_GRAPH_IDS = exports.GET_GRAPH_IDS = (0, _client().gql)`
15
+ query graph($ids: [String], $filter: String) {
16
+ graph(ids: $ids, filter: $filter) {
17
+ nodes {
18
+ id
19
+ }
20
+ edges {
21
+ sourceId
22
+ targetId
23
+ dependencyLifecycleType
24
+ }
25
+ }
26
+ }
27
+ `;
16
28
  const GET_GRAPH = exports.GET_GRAPH = (0, _client().gql)`
17
29
  query graph($ids: [String], $filter: String) {
18
30
  graph(ids: $ids, filter: $filter) {
@@ -1 +1 @@
1
- {"version":3,"names":["_client","data","require","GET_GRAPH","exports","gql"],"sources":["get-graph.query.ts"],"sourcesContent":["import { gql } from '@apollo/client';\nimport { EdgeType } from '../../edge-type';\n\n// please update types when updating query, for added safety\n\nexport const GET_GRAPH = gql`\n query graph($ids: [String], $filter: String) {\n graph(ids: $ids, filter: $filter) {\n nodes {\n id\n component {\n id {\n name\n version\n scope\n }\n displayName\n\n deprecation {\n isDeprecate\n }\n\n env {\n id\n icon\n }\n }\n }\n edges {\n sourceId\n targetId\n dependencyLifecycleType\n }\n }\n }\n`;\n\nexport type RawGraphQuery = {\n graph: RawGraph;\n};\n\nexport type RawGraph = {\n nodes: RawNode[];\n edges: [];\n};\n\nexport type RawNode = {\n id: string;\n component: {\n id: {\n name: string;\n scope: string;\n version: string;\n };\n\n displayName: string;\n\n deprecation: {\n isDeprecate: boolean;\n };\n\n env: {\n id: string;\n icon: string;\n };\n };\n};\n\nexport type RawEdge = {\n sourceId: string;\n targetId: string;\n dependencyLifecycleType: EdgeType;\n};\n"],"mappings":";;;;;;AAAA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA;;AAEO,MAAME,SAAS,GAAAC,OAAA,CAAAD,SAAA,GAAG,IAAAE,aAAG;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_client","data","require","GET_GRAPH_IDS","exports","gql","GET_GRAPH"],"sources":["get-graph.query.ts"],"sourcesContent":["import { gql } from '@apollo/client';\nimport { EdgeType } from '../../edge-type';\n\nexport const GET_GRAPH_IDS = gql`\n query graph($ids: [String], $filter: String) {\n graph(ids: $ids, filter: $filter) {\n nodes {\n id\n }\n edges {\n sourceId\n targetId\n dependencyLifecycleType\n }\n }\n }\n`;\n\nexport const GET_GRAPH = gql`\n query graph($ids: [String], $filter: String) {\n graph(ids: $ids, filter: $filter) {\n nodes {\n id\n component {\n id {\n name\n version\n scope\n }\n displayName\n\n deprecation {\n isDeprecate\n }\n\n env {\n id\n icon\n }\n }\n }\n edges {\n sourceId\n targetId\n dependencyLifecycleType\n }\n }\n }\n`;\n\nexport type RawGraphQuery = {\n graph: RawGraph;\n};\n\nexport type RawGraph = {\n nodes: RawNode[];\n edges: [];\n};\n\nexport type RawNode = {\n id: string;\n component?: {\n id: {\n name: string;\n scope: string;\n version: string;\n };\n displayName: string;\n deprecation: {\n isDeprecate: boolean;\n };\n env: {\n id: string;\n icon: string;\n };\n };\n};\n\nexport type RawEdge = {\n sourceId: string;\n targetId: string;\n dependencyLifecycleType: EdgeType;\n};\n"],"mappings":";;;;;;AAAA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGO,MAAME,aAAa,GAAAC,OAAA,CAAAD,aAAA,GAAG,IAAAE,aAAG;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAEM,MAAMC,SAAS,GAAAF,OAAA,CAAAE,SAAA,GAAG,IAAAD,aAAG;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
@@ -1,7 +1,8 @@
1
- import { ComponentModel } from '@teambit/component';
1
+ import { ComponentID, ComponentModel } from '@teambit/component';
2
2
  import { RawNode } from './get-graph.query';
3
3
  export declare class NodeModel {
4
4
  id: string;
5
- component: ComponentModel;
5
+ component?: ComponentModel;
6
+ componentId: ComponentID;
6
7
  static from(rawNode: RawNode): NodeModel;
7
8
  }
@@ -18,13 +18,15 @@ class NodeModel {
18
18
  constructor() {
19
19
  _defineProperty(this, "id", void 0);
20
20
  _defineProperty(this, "component", void 0);
21
+ _defineProperty(this, "componentId", void 0);
21
22
  }
22
23
  static from(rawNode) {
23
24
  const node = new NodeModel();
24
25
  node.id = rawNode.id;
25
26
  // @TODO - component model should not expect all fields to have values
26
27
  // @ts-ignore
27
- node.component = _component().ComponentModel.from(rawNode.component);
28
+ node.component = rawNode.component ? _component().ComponentModel.from(rawNode.component) : undefined;
29
+ node.componentId = node.component ? node.component.id : _component().ComponentID.fromString(rawNode.id);
28
30
  return node;
29
31
  }
30
32
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_component","data","require","_defineProperty","e","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","NodeModel","constructor","from","rawNode","node","id","component","ComponentModel","exports"],"sources":["node-model.ts"],"sourcesContent":["import { ComponentModel } from '@teambit/component';\nimport { RawNode } from './get-graph.query';\n\nexport class NodeModel {\n id: string;\n component: ComponentModel;\n\n static from(rawNode: RawNode) {\n const node = new NodeModel();\n node.id = rawNode.id;\n // @TODO - component model should not expect all fields to have values\n // @ts-ignore\n node.component = ComponentModel.from(rawNode.component);\n return node;\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,WAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,UAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAoD,SAAAE,gBAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAD,CAAA,GAAAI,MAAA,CAAAC,cAAA,CAAAL,CAAA,EAAAC,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAAA,MAAAC,QAAA,UAAAT,CAAA,CAAAC,CAAA,IAAAC,CAAA,EAAAF,CAAA;AAAA,SAAAG,eAAAD,CAAA,QAAAQ,CAAA,GAAAC,YAAA,CAAAT,CAAA,uCAAAQ,CAAA,GAAAA,CAAA,GAAAA,CAAA;AAAA,SAAAC,aAAAT,CAAA,EAAAD,CAAA,2BAAAC,CAAA,KAAAA,CAAA,SAAAA,CAAA,MAAAF,CAAA,GAAAE,CAAA,CAAAU,MAAA,CAAAC,WAAA,kBAAAb,CAAA,QAAAU,CAAA,GAAAV,CAAA,CAAAc,IAAA,CAAAZ,CAAA,EAAAD,CAAA,uCAAAS,CAAA,SAAAA,CAAA,YAAAK,SAAA,yEAAAd,CAAA,GAAAe,MAAA,GAAAC,MAAA,EAAAf,CAAA;AAG7C,MAAMgB,SAAS,CAAC;EAAAC,YAAA;IAAApB,eAAA;IAAAA,eAAA;EAAA;EAIrB,OAAOqB,IAAIA,CAACC,OAAgB,EAAE;IAC5B,MAAMC,IAAI,GAAG,IAAIJ,SAAS,CAAC,CAAC;IAC5BI,IAAI,CAACC,EAAE,GAAGF,OAAO,CAACE,EAAE;IACpB;IACA;IACAD,IAAI,CAACE,SAAS,GAAGC,2BAAc,CAACL,IAAI,CAACC,OAAO,CAACG,SAAS,CAAC;IACvD,OAAOF,IAAI;EACb;AACF;AAACI,OAAA,CAAAR,SAAA,GAAAA,SAAA","ignoreList":[]}
1
+ {"version":3,"names":["_component","data","require","_defineProperty","e","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","NodeModel","constructor","from","rawNode","node","id","component","ComponentModel","undefined","componentId","ComponentID","fromString","exports"],"sources":["node-model.ts"],"sourcesContent":["import { ComponentID, ComponentModel } from '@teambit/component';\nimport { RawNode } from './get-graph.query';\n\nexport class NodeModel {\n id: string;\n component?: ComponentModel;\n componentId: ComponentID;\n\n static from(rawNode: RawNode) {\n const node = new NodeModel();\n node.id = rawNode.id;\n // @TODO - component model should not expect all fields to have values\n // @ts-ignore\n node.component = rawNode.component ? ComponentModel.from(rawNode.component) : undefined;\n node.componentId = node.component ? node.component.id : ComponentID.fromString(rawNode.id);\n return node;\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,WAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,UAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAiE,SAAAE,gBAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAD,CAAA,GAAAI,MAAA,CAAAC,cAAA,CAAAL,CAAA,EAAAC,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAAA,MAAAC,QAAA,UAAAT,CAAA,CAAAC,CAAA,IAAAC,CAAA,EAAAF,CAAA;AAAA,SAAAG,eAAAD,CAAA,QAAAQ,CAAA,GAAAC,YAAA,CAAAT,CAAA,uCAAAQ,CAAA,GAAAA,CAAA,GAAAA,CAAA;AAAA,SAAAC,aAAAT,CAAA,EAAAD,CAAA,2BAAAC,CAAA,KAAAA,CAAA,SAAAA,CAAA,MAAAF,CAAA,GAAAE,CAAA,CAAAU,MAAA,CAAAC,WAAA,kBAAAb,CAAA,QAAAU,CAAA,GAAAV,CAAA,CAAAc,IAAA,CAAAZ,CAAA,EAAAD,CAAA,uCAAAS,CAAA,SAAAA,CAAA,YAAAK,SAAA,yEAAAd,CAAA,GAAAe,MAAA,GAAAC,MAAA,EAAAf,CAAA;AAG1D,MAAMgB,SAAS,CAAC;EAAAC,YAAA;IAAApB,eAAA;IAAAA,eAAA;IAAAA,eAAA;EAAA;EAKrB,OAAOqB,IAAIA,CAACC,OAAgB,EAAE;IAC5B,MAAMC,IAAI,GAAG,IAAIJ,SAAS,CAAC,CAAC;IAC5BI,IAAI,CAACC,EAAE,GAAGF,OAAO,CAACE,EAAE;IACpB;IACA;IACAD,IAAI,CAACE,SAAS,GAAGH,OAAO,CAACG,SAAS,GAAGC,2BAAc,CAACL,IAAI,CAACC,OAAO,CAACG,SAAS,CAAC,GAAGE,SAAS;IACvFJ,IAAI,CAACK,WAAW,GAAGL,IAAI,CAACE,SAAS,GAAGF,IAAI,CAACE,SAAS,CAACD,EAAE,GAAGK,wBAAW,CAACC,UAAU,CAACR,OAAO,CAACE,EAAE,CAAC;IAC1F,OAAOD,IAAI;EACb;AACF;AAACQ,OAAA,CAAAZ,SAAA,GAAAA,SAAA","ignoreList":[]}
@@ -1,8 +1,9 @@
1
1
  import { GraphQlError } from '@teambit/graphql';
2
2
  import { GraphModel } from './graph-model';
3
- /** provides dependencies graph data from graphQL */
4
3
  export declare function useGraphQuery(componentId?: string[], filter?: string): {
5
4
  graph: GraphModel<import("./node-model").NodeModel, import("./edge-model").EdgeModel> | undefined;
6
5
  error: GraphQlError | undefined;
7
6
  loading: boolean;
7
+ idsLoading: boolean;
8
+ graphLoading: boolean;
8
9
  };
@@ -11,9 +11,9 @@ function _react() {
11
11
  };
12
12
  return data;
13
13
  }
14
- function _uiFoundationUiHooks() {
15
- const data = require("@teambit/ui-foundation.ui.hooks.use-data-query");
16
- _uiFoundationUiHooks = function () {
14
+ function _client() {
15
+ const data = require("@apollo/client");
16
+ _client = function () {
17
17
  return data;
18
18
  };
19
19
  return data;
@@ -39,29 +39,58 @@ function _graphModel() {
39
39
  };
40
40
  return data;
41
41
  }
42
- /** provides dependencies graph data from graphQL */
43
42
  function useGraphQuery(componentId, filter) {
43
+ // Eagerly fetch GET_GRAPH_IDS
44
44
  const {
45
- data,
46
- error,
47
- loading
48
- } = (0, _uiFoundationUiHooks().useDataQuery)(_getGraph().GET_GRAPH, {
45
+ data: idsData,
46
+ error: idsError,
47
+ loading: idsLoading
48
+ } = (0, _client().useQuery)(_getGraph().GET_GRAPH_IDS, {
49
49
  variables: {
50
50
  ids: componentId,
51
51
  filter
52
52
  },
53
- skip: !componentId
53
+ skip: !componentId || !filter
54
54
  });
55
- const rawGraph = data?.graph;
56
- const clientError = !rawGraph && !loading ? new (_graphql().GraphQlError)(404) : undefined;
57
- const serverError = error ? new (_graphql().GraphQlError)(500, error.message) : undefined;
55
+
56
+ // Lazily fetch GET_GRAPH
57
+ const [getGraph, {
58
+ data: graphData,
59
+ error: graphError,
60
+ loading: graphLoading
61
+ }] = (0, _client().useLazyQuery)(_getGraph().GET_GRAPH);
62
+ const [fetchError, setFetchError] = (0, _react().useState)(undefined);
63
+ const [shouldRefetchGraph, setShouldRefetchGraph] = (0, _react().useState)(false);
64
+ (0, _react().useEffect)(() => {
65
+ if (idsData?.graph.nodes.length || !filter) {
66
+ setShouldRefetchGraph(true);
67
+ }
68
+ }, [idsData?.graph.nodes.length, filter]);
69
+ (0, _react().useEffect)(() => {
70
+ if (shouldRefetchGraph) {
71
+ setShouldRefetchGraph(false);
72
+ void getGraph({
73
+ variables: {
74
+ ids: componentId,
75
+ filter
76
+ }
77
+ }).catch(error => {
78
+ setFetchError(new (_graphql().GraphQlError)(500, error.message));
79
+ });
80
+ }
81
+ }, [componentId, filter, getGraph, shouldRefetchGraph]);
82
+ const rawGraph = idsLoading ? undefined : idsData?.graph && graphData?.graph && idsData?.graph.nodes.length === graphData?.graph.nodes.length && graphData?.graph || idsData?.graph || graphData?.graph;
83
+ const clientError = !rawGraph && !idsLoading && !graphLoading ? new (_graphql().GraphQlError)(404) : undefined;
84
+ const serverError = graphError?.message || idsError?.message ? new (_graphql().GraphQlError)(500, graphError?.message || idsError?.message) : fetchError;
58
85
  return (0, _react().useMemo)(() => {
59
86
  return {
60
87
  graph: rawGraph ? _graphModel().GraphModel.from(rawGraph) : undefined,
61
88
  error: serverError || clientError,
62
- loading
89
+ loading: idsLoading || graphLoading,
90
+ idsLoading,
91
+ graphLoading
63
92
  };
64
- }, [rawGraph, error]);
93
+ }, [rawGraph, serverError, clientError, idsLoading, graphLoading]);
65
94
  }
66
95
 
67
96
  //# sourceMappingURL=use-graph-query.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_react","data","require","_uiFoundationUiHooks","_graphql","_getGraph","_graphModel","useGraphQuery","componentId","filter","error","loading","useDataQuery","GET_GRAPH","variables","ids","skip","rawGraph","graph","clientError","GraphQlError","undefined","serverError","message","useMemo","GraphModel","from"],"sources":["use-graph-query.ts"],"sourcesContent":["import { useMemo } from 'react';\nimport { useDataQuery } from '@teambit/ui-foundation.ui.hooks.use-data-query';\nimport { GraphQlError } from '@teambit/graphql';\nimport { GET_GRAPH, RawGraphQuery } from './get-graph.query';\nimport { GraphModel } from './graph-model';\n\ntype QueryVariables = {\n ids?: string[];\n filter?: string;\n};\n\n/** provides dependencies graph data from graphQL */\nexport function useGraphQuery(componentId?: string[], filter?: string) {\n const { data, error, loading } = useDataQuery<RawGraphQuery, QueryVariables>(GET_GRAPH, {\n variables: { ids: componentId, filter },\n skip: !componentId,\n });\n\n const rawGraph = data?.graph;\n const clientError = !rawGraph && !loading ? new GraphQlError(404) : undefined;\n const serverError = error ? new GraphQlError(500, error.message) : undefined;\n\n return useMemo(() => {\n return {\n graph: rawGraph ? GraphModel.from(rawGraph) : undefined,\n error: serverError || clientError,\n loading,\n };\n }, [rawGraph, error]);\n}\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,qBAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,oBAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;A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el","useGraphQuery","componentId","filter","idsData","error","idsError","loading","idsLoading","useQuery","GET_GRAPH_IDS","variables","ids","skip","getGraph","graphData","graphError","graphLoading","useLazyQuery","GET_GRAPH","fetchError","setFetchError","useState","undefined","shouldRefetchGraph","setShouldRefetchGraph","useEffect","graph","nodes","length","catch","GraphQlError","message","rawGraph","clientError","serverError","useMemo","GraphModel","from"],"sources":["use-graph-query.ts"],"sourcesContent":["import { useMemo, useEffect, useState } from 'react';\nimport { useQuery, useLazyQuery } from '@apollo/client';\nimport { GraphQlError } from '@teambit/graphql';\nimport { GET_GRAPH, RawGraphQuery, GET_GRAPH_IDS } from './get-graph.query';\nimport { GraphModel } from './graph-model';\n\ntype QueryVariables = {\n ids?: string[];\n filter?: string;\n};\n\nexport function useGraphQuery(componentId?: string[], filter?: string) {\n // Eagerly fetch GET_GRAPH_IDS\n const {\n data: idsData,\n error: idsError,\n loading: idsLoading,\n } = useQuery<RawGraphQuery, QueryVariables>(GET_GRAPH_IDS, {\n variables: { ids: componentId, filter },\n skip: !componentId || !filter,\n });\n\n // Lazily fetch GET_GRAPH\n const [getGraph, { data: graphData, error: graphError, loading: graphLoading }] = useLazyQuery<\n RawGraphQuery,\n QueryVariables\n >(GET_GRAPH);\n\n const [fetchError, setFetchError] = useState<GraphQlError | undefined>(undefined);\n\n const [shouldRefetchGraph, setShouldRefetchGraph] = useState(false);\n\n useEffect(() => {\n if (idsData?.graph.nodes.length || !filter) {\n setShouldRefetchGraph(true);\n }\n }, [idsData?.graph.nodes.length, filter]);\n\n useEffect(() => {\n if (shouldRefetchGraph) {\n setShouldRefetchGraph(false);\n void getGraph({ variables: { ids: componentId, filter } }).catch((error) => {\n setFetchError(new GraphQlError(500, error.message));\n });\n }\n }, [componentId, filter, getGraph, shouldRefetchGraph]);\n\n const rawGraph = idsLoading\n ? undefined\n : (idsData?.graph &&\n graphData?.graph &&\n idsData?.graph.nodes.length === graphData?.graph.nodes.length &&\n graphData?.graph) ||\n idsData?.graph ||\n graphData?.graph;\n\n const clientError = !rawGraph && !idsLoading && !graphLoading ? new GraphQlError(404) : undefined;\n const serverError =\n graphError?.message || idsError?.message\n ? new GraphQlError(500, graphError?.message || idsError?.message)\n : fetchError;\n\n return useMemo(() => {\n return {\n graph: rawGraph ? GraphModel.from(rawGraph) : undefined,\n error: serverError || clientError,\n loading: idsLoading || graphLoading,\n idsLoading,\n graphLoading,\n };\n }, [rawGraph, serverError, clientError, idsLoading, graphLoading]);\n}\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,QAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,SAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,QAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,UAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,SAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,YAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,WAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAOO,SAASM,aAAaA,CAACC,WAAsB,EAAEC,MAAe,EAAE;EACrE;EACA,MAAM;IACJR,IAAI,EAAES,OAAO;IACbC,KAAK,EAAEC,QAAQ;IACfC,OAAO,EAAEC;EACX,CAAC,GAAG,IAAAC,kBAAQ,EAAgCC,yBAAa,EAAE;IACzDC,SAAS,EAAE;MAAEC,GAAG,EAAEV,WAAW;MAAEC;IAAO,CAAC;IACvCU,IAAI,EAAE,CAACX,W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Kd,SAAS,EAAEY,KAAK,CAACC,KAAK,CAACC,MAAM,IAC7Dd,SAAS,EAAEY,KAAK,IAClBvB,OAAO,EAAEuB,KAAK,IACdZ,SAAS,EAAEY,KAAK;EAEpB,MAAMO,WAAW,GAAG,CAACD,QAAQ,IAAI,CAACzB,UAAU,IAAI,CAACS,YAAY,GAAG,KAAIc,uBAAY,EAAC,GAAG,CAAC,GAAGR,SAAS;EACjG,MAAMY,WAAW,GACfnB,UAAU,EAAEgB,OAAO,IAAI1B,QAAQ,EAAE0B,OAAO,GACpC,KAAID,uBAAY,EAAC,GAAG,EAAEf,UAAU,EAAEgB,OAAO,IAAI1B,QAAQ,EAAE0B,OAAO,CAAC,GAC/DZ,UAAU;EAEhB,OAAO,IAAAgB,gBAAO,EAAC,MAAM;IACnB,OAAO;MACLT,KAAK,EAAEM,QAAQ,GAAGI,wBAAU,CAACC,IAAI,CAACL,QAAQ,CAAC,GAAGV,SAAS;MACvDlB,KAAK,EAAE8B,WAAW,IAAID,WAAW;MACjC3B,OAAO,EAAEC,UAAU,IAAIS,YAAY;MACnCT,UAAU;MACVS;IACF,CAAC;EACH,CAAC,EAAE,CAACgB,QAAQ,EAAEE,WAAW,EAAED,WAAW,EAAE1B,UAAU,EAAES,YAAY,CAAC,CAAC;AACpE","ignoreList":[]}
@@ -2,4 +2,6 @@ export declare function useGraph(): {
2
2
  graph: import("./graph-model").GraphModel<import("./node-model").NodeModel, import("./edge-model").EdgeModel> | undefined;
3
3
  error: import("@teambit/graphql").GraphQlError | undefined;
4
4
  loading: boolean;
5
+ idsLoading: boolean;
6
+ graphLoading: boolean;
5
7
  };
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/graph",
3
- "version": "1.0.316",
3
+ "version": "1.0.318",
4
4
  "homepage": "https://bit.cloud/teambit/component/graph",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.component",
8
8
  "name": "graph",
9
- "version": "1.0.316"
9
+ "version": "1.0.318"
10
10
  },
11
11
  "dependencies": {
12
12
  "graphlib": "2.1.8",
@@ -15,8 +15,8 @@
15
15
  "graphql-tag": "2.12.1",
16
16
  "classnames": "2.2.6",
17
17
  "reactflow": "^11.11.3",
18
- "semver": "7.5.2",
19
18
  "@dagrejs/dagre": "^1.1.2",
19
+ "semver": "7.5.2",
20
20
  "@teambit/component-id": "1.2.0",
21
21
  "@teambit/graph.cleargraph": "0.0.11",
22
22
  "@teambit/harmony": "0.4.6",
@@ -26,23 +26,21 @@
26
26
  "@teambit/component.ui.deprecation-icon": "0.0.509",
27
27
  "@teambit/design.ui.styles.ellipsis": "0.0.357",
28
28
  "@teambit/base-ui.routing.nav-link": "1.0.0",
29
- "@teambit/design.ui.round-loader": "0.0.355",
30
- "@teambit/component.ui.component-compare.status-resolver": "0.0.9",
31
- "@teambit/evangelist.input.checkbox.label": "1.0.3",
29
+ "@teambit/evangelist.input.checkbox.label": "1.0.14",
30
+ "@teambit/design.skeletons.base-skeleton": "0.0.2",
32
31
  "@teambit/design.ui.pages.not-found": "0.0.371",
33
32
  "@teambit/design.ui.pages.server-error": "0.0.368",
34
- "@teambit/documenter.ui.heading": "4.1.1",
35
- "@teambit/ui-foundation.ui.full-loader": "0.0.500",
36
- "@teambit/ui-foundation.ui.hooks.use-data-query": "0.0.505",
33
+ "@teambit/design.ui.round-loader": "0.0.355",
34
+ "@teambit/component.ui.component-compare.status-resolver": "0.0.9",
37
35
  "@teambit/ui-foundation.ui.react-router.use-query": "0.0.501",
38
- "@teambit/component": "1.0.316",
39
- "@teambit/cli": "0.0.893",
36
+ "@teambit/component": "1.0.318",
37
+ "@teambit/cli": "0.0.895",
40
38
  "@teambit/toolbox.string.random": "0.0.1",
41
39
  "@teambit/component.ui.component-compare.models.component-compare-props": "0.0.109",
42
- "@teambit/graphql": "1.0.316",
43
- "@teambit/logger": "0.0.986",
44
- "@teambit/component-compare": "1.0.316",
45
- "@teambit/ui": "1.0.316",
40
+ "@teambit/graphql": "1.0.318",
41
+ "@teambit/logger": "0.0.988",
42
+ "@teambit/component-compare": "1.0.318",
43
+ "@teambit/ui": "1.0.318",
46
44
  "@teambit/component.modules.component-url": "0.0.167",
47
45
  "@teambit/envs.ui.env-icon": "0.0.505",
48
46
  "@teambit/component.ui.component-compare.context": "0.0.118"
@@ -22,13 +22,13 @@ export interface IComponentNode extends CardProps {
22
22
 
23
23
  export function ComponentNode({ node, type = 'defaultNode', ...rest }: IComponentNode) {
24
24
  const graphContext = useContext(ComponentGraphContext);
25
- const { component } = node;
26
- const { id } = component;
25
+ const { component, componentId } = node;
26
+ const id = component?.id || componentId;
27
27
 
28
28
  return (
29
29
  <Card className={classnames(styles.compNode, variants[type])} elevation="none" {...rest}>
30
30
  <div className={styles.firstRow}>
31
- <EnvIcon component={component} className={styles.envIcon} />
31
+ {component && <EnvIcon component={component} className={styles.envIcon} />}
32
32
  <Breadcrumbs componentId={id} className={mutedText} />
33
33
  </div>
34
34
  <div className={styles.nameLine}>
@@ -38,8 +38,9 @@ export function ComponentNode({ node, type = 'defaultNode', ...rest }: IComponen
38
38
  {id.version && <span className={classnames(styles.version, ellipsis)}>{id.version}</span>}
39
39
 
40
40
  <div className={styles.buffs}>
41
- <DeprecationIcon component={component} />
42
- {graphContext &&
41
+ {component && <DeprecationIcon component={component} />}
42
+ {component &&
43
+ graphContext &&
43
44
  graphContext.componentWidgets
44
45
  .toArray()
45
46
  .map(([widgetId, Widget]) => <Widget key={widgetId} component={component} />)}
@@ -5,7 +5,7 @@ export type CompareStatus = 'modified' | 'new' | 'deleted' | undefined;
5
5
 
6
6
  export class CompareNodeModel extends NodeModel {
7
7
  id: string;
8
- component: ComponentModel;
8
+ component?: ComponentModel;
9
9
  compareVersion: string;
10
10
  status: CompareStatus;
11
11
  }
@@ -36,8 +36,8 @@ export type DependencyCompareNodeProps = {
36
36
 
37
37
  export function DependencyCompareNode(props: DependencyCompareNodeProps) {
38
38
  const { node, type = 'defaultNode' } = props;
39
- const { id: baseIdStr, component: baseComponent, compareVersion, status } = node;
40
- const { version: baseVersion } = baseComponent;
39
+ const { id: baseIdStr, component: baseComponent, compareVersion, status, componentId } = node;
40
+ const { version: baseVersion } = baseComponent || { version: componentId.version };
41
41
  const baseId = ComponentID.fromString(baseIdStr);
42
42
  const versionDiff = useMemo(
43
43
  () => valid(baseVersion) && valid(compareVersion) && compare(baseVersion, compareVersion),
@@ -47,7 +47,7 @@ export function DependencyCompareNode(props: DependencyCompareNodeProps) {
47
47
  return (
48
48
  <Card className={classnames(componentNodeStyles.compNode, getVariant(type))} elevation="none">
49
49
  <div className={componentNodeStyles.firstRow}>
50
- <EnvIcon component={baseComponent} className={componentNodeStyles.envIcon} />
50
+ {baseComponent && <EnvIcon component={baseComponent} className={componentNodeStyles.envIcon} />}
51
51
  <Breadcrumbs componentId={baseId} className={mutedText} />
52
52
  </div>
53
53
  <div className={componentNodeStyles.nameLine}>
@@ -76,7 +76,7 @@ export function DependencyCompareNode(props: DependencyCompareNodeProps) {
76
76
  )}
77
77
 
78
78
  <div className={styles.buffs}>
79
- <DeprecationIcon component={baseComponent} />
79
+ {baseComponent && <DeprecationIcon component={baseComponent} />}
80
80
  {status !== undefined && <CompareStatusResolver status={status} />}
81
81
  </div>
82
82
  </div>
@@ -3,7 +3,7 @@ import { EdgeModel, GraphModel, NodeModel } from '../query';
3
3
  import { CompareGraphModel } from './compare-graph-model';
4
4
  import { CompareNodeModel } from './compare-node-model';
5
5
 
6
- const toShortId = (node: NodeModel) => node.component.id.toStringWithoutVersion();
6
+ const toShortId = (node: NodeModel) => node.componentId.toStringWithoutVersion();
7
7
 
8
8
  // this is to get a key with versions ignored so that we'll have a unique set of component nodes
9
9
  const toShortIdFromNodeId = (nodeId: string) => nodeId.split('@')[0];
@@ -30,16 +30,17 @@ export function diffGraph(
30
30
  const allNodes: Array<CompareNodeModel> = [];
31
31
  for (const baseNode of baseNodes) {
32
32
  const compareNode = compareNodesMap.get(toShortId(baseNode));
33
+
33
34
  if (compareNode) {
34
35
  allNodes.push({
35
36
  ...baseNode,
36
- compareVersion: compareNode.component.version,
37
- status: compareNode.component.id.isEqual(baseNode.component.id) ? undefined : 'modified',
37
+ compareVersion: compareNode.componentId.version,
38
+ status: compareNode.componentId.isEqual(baseNode.componentId) ? undefined : 'modified',
38
39
  });
39
40
  } else {
40
41
  allNodes.push({
41
42
  ...baseNode,
42
- compareVersion: baseNode.component.version,
43
+ compareVersion: baseNode.componentId.version,
43
44
  status: 'deleted',
44
45
  });
45
46
  }
@@ -28,7 +28,7 @@ export function calcElements(
28
28
  type: 'ComponentNode',
29
29
  data: {
30
30
  node: x,
31
- type: rootNode && x.component.id.isEqual(rootNode, { ignoreVersion: true }) ? 'root' : undefined,
31
+ type: rootNode && x.componentId.isEqual(rootNode, { ignoreVersion: true }) ? 'root' : undefined,
32
32
  },
33
33
  position: positions.get(x.id) || { x: 0, y: 0 },
34
34
  };
@@ -49,5 +49,5 @@ export function calcElements(
49
49
  }));
50
50
 
51
51
  return { nodes, edges };
52
- }, [graph]);
52
+ }, [graph?.nodes.length, graph?.edges.length, rootNode?.toString(), graph?.nodes.some((n) => n.component)]);
53
53
  }