@teambit/code.ui.queries.get-file-content 0.0.498 → 0.0.500

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.
@@ -12,7 +12,7 @@ declare type FileResult = {
12
12
  };
13
13
  };
14
14
  };
15
- export declare function useFileContent(componentId?: ComponentID, filePath?: string): {
15
+ export declare function useFileContent(componentId?: ComponentID, filePath?: string, skip?: boolean): {
16
16
  client: import("@apollo/client").ApolloClient<any>;
17
17
  observable: import("@apollo/client").ObservableQuery<FileResult, import("@apollo/client").OperationVariables>;
18
18
  previousData?: FileResult;
@@ -30,12 +30,12 @@ const getFile = (0, client_1.gql) `
30
30
  }
31
31
  }
32
32
  `;
33
- function useFileContent(componentId, filePath) {
33
+ function useFileContent(componentId, filePath, skip) {
34
34
  var _a;
35
35
  const id = componentId === null || componentId === void 0 ? void 0 : componentId.toString();
36
36
  const _b = (0, ui_foundation_ui_hooks_use_data_query_1.useDataQuery)(getFile, {
37
37
  variables: { id, path: filePath },
38
- skip: !componentId || filePath === undefined,
38
+ skip: skip || !componentId || filePath === undefined,
39
39
  }), { data } = _b, rest = __rest(_b, ["data"]);
40
40
  const fileContent = (_a = data === null || data === void 0 ? void 0 : data.getHost) === null || _a === void 0 ? void 0 : _a.get.getFile;
41
41
  return Object.assign({ fileContent }, rest);
@@ -1 +1 @@
1
- {"version":3,"file":"get-file-content.js","sourceRoot":"","sources":["../get-file-content.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,2CAAqC;AACrC,0GAA8E;AAG9E,MAAM,OAAO,GAAG,IAAA,YAAG,EAAA;;;;;;;;;;;;;;;CAelB,CAAC;AAgBF,SAAgB,cAAc,CAAC,WAAyB,EAAE,QAAiB;;IACzE,MAAM,EAAE,GAAG,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,QAAQ,EAAE,CAAC;IACnC,MAAM,KAAoB,IAAA,oDAAY,EAAa,OAAO,EAAE;QAC1D,SAAS,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QACjC,IAAI,EAAE,CAAC,WAAW,IAAI,QAAQ,KAAK,SAAS;KAC7C,CAAC,EAHI,EAAE,IAAI,OAGV,EAHe,IAAI,cAAf,QAAiB,CAGrB,CAAC;IAEH,MAAM,WAAW,GAAG,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,OAAO,0CAAE,GAAG,CAAC,OAAO,CAAC;IAE/C,uBAAS,WAAW,IAAK,IAAI,EAAG;AAClC,CAAC;AAVD,wCAUC"}
1
+ {"version":3,"file":"get-file-content.js","sourceRoot":"","sources":["../get-file-content.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,2CAAqC;AACrC,0GAA8E;AAG9E,MAAM,OAAO,GAAG,IAAA,YAAG,EAAA;;;;;;;;;;;;;;;CAelB,CAAC;AAgBF,SAAgB,cAAc,CAAC,WAAyB,EAAE,QAAiB,EAAE,IAAc;;IACzF,MAAM,EAAE,GAAG,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,QAAQ,EAAE,CAAC;IACnC,MAAM,KAAoB,IAAA,oDAAY,EAAa,OAAO,EAAE;QAC1D,SAAS,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QACjC,IAAI,EAAE,IAAI,IAAI,CAAC,WAAW,IAAI,QAAQ,KAAK,SAAS;KACrD,CAAC,EAHI,EAAE,IAAI,OAGV,EAHe,IAAI,cAAf,QAAiB,CAGrB,CAAC;IAEH,MAAM,WAAW,GAAG,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,OAAO,0CAAE,GAAG,CAAC,OAAO,CAAC;IAE/C,uBAAS,WAAW,IAAK,IAAI,EAAG;AAClC,CAAC;AAVD,wCAUC"}
@@ -33,11 +33,11 @@ type FileResult = {
33
33
  };
34
34
  };
35
35
 
36
- export function useFileContent(componentId?: ComponentID, filePath?: string) {
36
+ export function useFileContent(componentId?: ComponentID, filePath?: string, skip?: boolean) {
37
37
  const id = componentId?.toString();
38
38
  const { data, ...rest } = useDataQuery<FileResult>(getFile, {
39
39
  variables: { id, path: filePath },
40
- skip: !componentId || filePath === undefined,
40
+ skip: skip || !componentId || filePath === undefined,
41
41
  });
42
42
 
43
43
  const fileContent = data?.getHost?.get.getFile;
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@teambit/code.ui.queries.get-file-content",
3
- "version": "0.0.498",
3
+ "version": "0.0.500",
4
4
  "homepage": "https://bit.dev/teambit/code/ui/queries/get-file-content",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.code",
8
8
  "name": "ui/queries/get-file-content",
9
- "version": "0.0.498"
9
+ "version": "0.0.500"
10
10
  },
11
11
  "dependencies": {
12
12
  "core-js": "^3.0.0",
13
- "@teambit/ui-foundation.ui.hooks.use-data-query": "0.0.497"
13
+ "@teambit/ui-foundation.ui.hooks.use-data-query": "0.0.498"
14
14
  },
15
15
  "devDependencies": {
16
16
  "@types/mocha": "9.1.0",