@teambit/lanes.hooks.use-lanes 0.0.22 → 0.0.26
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.
- package/dist/lanes-provider.d.ts +3 -1
- package/dist/lanes-provider.js +4 -3
- package/dist/lanes-provider.js.map +1 -1
- package/dist/use-lanes.d.ts +1 -1
- package/dist/use-lanes.js +4 -4
- package/dist/use-lanes.js.map +1 -1
- package/lanes-provider.tsx +6 -3
- package/package-tar/teambit-lanes.hooks.use-lanes-0.0.26.tgz +0 -0
- package/package.json +13 -9
- package/{preview-1662089982043.js → preview-1662694416892.js} +0 -0
- package/use-lanes.tsx +5 -4
- package/package-tar/teambit-lanes.hooks.use-lanes-0.0.22.tgz +0 -0
package/dist/lanes-provider.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
+
import { LanesModel } from '@teambit/lanes.ui.models';
|
|
2
3
|
export declare type LanesProviderProps = {
|
|
3
4
|
children: ReactNode;
|
|
4
5
|
viewedLaneId?: string;
|
|
6
|
+
targetLanesModel?: LanesModel;
|
|
5
7
|
};
|
|
6
|
-
export declare function LanesProvider({ children, viewedLaneId }: LanesProviderProps): JSX.Element;
|
|
8
|
+
export declare function LanesProvider({ children, viewedLaneId, targetLanesModel }: LanesProviderProps): JSX.Element;
|
package/dist/lanes-provider.js
CHANGED
|
@@ -7,9 +7,10 @@ exports.LanesProvider = void 0;
|
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const lanes_hooks_use_lanes_1 = require("@teambit/lanes.hooks.use-lanes");
|
|
9
9
|
const lanes_context_1 = require("./lanes-context");
|
|
10
|
-
function LanesProvider({ children, viewedLaneId }) {
|
|
11
|
-
const { lanesModel } = (0, lanes_hooks_use_lanes_1.useLanes)(() => viewedLaneId);
|
|
12
|
-
|
|
10
|
+
function LanesProvider({ children, viewedLaneId, targetLanesModel }) {
|
|
11
|
+
const { lanesModel } = (0, lanes_hooks_use_lanes_1.useLanes)(() => viewedLaneId, !!targetLanesModel);
|
|
12
|
+
const targetModel = !lanesModel ? targetLanesModel : lanesModel;
|
|
13
|
+
return react_1.default.createElement(lanes_context_1.LanesContext.Provider, { value: targetModel }, children);
|
|
13
14
|
}
|
|
14
15
|
exports.LanesProvider = LanesProvider;
|
|
15
16
|
//# sourceMappingURL=lanes-provider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lanes-provider.js","sourceRoot":"","sources":["../lanes-provider.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAAyC;AACzC,0EAA0D;AAC1D,mDAA+C;
|
|
1
|
+
{"version":3,"file":"lanes-provider.js","sourceRoot":"","sources":["../lanes-provider.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAAyC;AACzC,0EAA0D;AAC1D,mDAA+C;AAS/C,SAAgB,aAAa,CAAC,EAAE,QAAQ,EAAE,YAAY,EAAE,gBAAgB,EAAsB;IAC5F,MAAM,EAAE,UAAU,EAAE,GAAG,IAAA,gCAAQ,EAAC,GAAG,EAAE,CAAC,YAAY,EAAE,CAAC,CAAC,gBAAgB,CAAC,CAAC;IACxE,MAAM,WAAW,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,UAAU,CAAC;IAChE,OAAO,8BAAC,4BAAY,CAAC,QAAQ,IAAC,KAAK,EAAE,WAAW,IAAG,QAAQ,CAAyB,CAAC;AACvF,CAAC;AAJD,sCAIC"}
|
package/dist/use-lanes.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LanesModel, LanesQuery } from '@teambit/lanes.ui.models';
|
|
2
2
|
import { QueryResult } from '@apollo/client';
|
|
3
|
-
export declare function useLanes(getViewedLaneId?: () => string | undefined): {
|
|
3
|
+
export declare function useLanes(getViewedLaneId?: () => string | undefined, skip?: boolean): {
|
|
4
4
|
lanesModel?: LanesModel;
|
|
5
5
|
} & Omit<QueryResult<LanesQuery>, 'data'>;
|
package/dist/use-lanes.js
CHANGED
|
@@ -50,12 +50,12 @@ const GET_LANES = (0, client_1.gql) `
|
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
`;
|
|
53
|
-
function useLanes(getViewedLaneId) {
|
|
53
|
+
function useLanes(getViewedLaneId, skip) {
|
|
54
54
|
var _a;
|
|
55
55
|
const lanesContext = (0, lanes_context_1.useLanesContext)();
|
|
56
|
-
const
|
|
57
|
-
const _b = (0, ui_foundation_ui_hooks_use_data_query_1.useDataQuery)(GET_LANES, { skip }), { data } = _b, rest = __rest(_b, ["data"]);
|
|
58
|
-
const { scope, loading } = (0, scope_ui_hooks_use_scope_1.useScopeQuery)(
|
|
56
|
+
const shouldSkip = skip || !!lanesContext;
|
|
57
|
+
const _b = (0, ui_foundation_ui_hooks_use_data_query_1.useDataQuery)(GET_LANES, { skip: shouldSkip }), { data } = _b, rest = __rest(_b, ["data"]);
|
|
58
|
+
const { scope, loading } = (0, scope_ui_hooks_use_scope_1.useScopeQuery)(shouldSkip);
|
|
59
59
|
let lanesModel;
|
|
60
60
|
if (lanesContext)
|
|
61
61
|
lanesModel = lanesContext;
|
package/dist/use-lanes.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-lanes.js","sourceRoot":"","sources":["../use-lanes.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,gFAAkE;AAClE,iCAAkC;AAClC,0GAA8E;AAC9E,8DAAkE;AAClE,2CAAkD;AAClD,mDAAkD;AAElD,MAAM,SAAS,GAAG,IAAA,YAAG,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+BpB,CAAC;AAEF,SAAgB,QAAQ,CACtB,eAA0C;;
|
|
1
|
+
{"version":3,"file":"use-lanes.js","sourceRoot":"","sources":["../use-lanes.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,gFAAkE;AAClE,iCAAkC;AAClC,0GAA8E;AAC9E,8DA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 -1,13 +1,16 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
2
|
import { useLanes } from '@teambit/lanes.hooks.use-lanes';
|
|
3
3
|
import { LanesContext } from './lanes-context';
|
|
4
|
+
import { LanesModel } from '@teambit/lanes.ui.models';
|
|
4
5
|
|
|
5
6
|
export type LanesProviderProps = {
|
|
6
7
|
children: ReactNode;
|
|
7
8
|
viewedLaneId?: string;
|
|
9
|
+
targetLanesModel?: LanesModel;
|
|
8
10
|
};
|
|
9
11
|
|
|
10
|
-
export function LanesProvider({ children, viewedLaneId }: LanesProviderProps) {
|
|
11
|
-
const { lanesModel } = useLanes(() => viewedLaneId);
|
|
12
|
-
|
|
12
|
+
export function LanesProvider({ children, viewedLaneId, targetLanesModel }: LanesProviderProps) {
|
|
13
|
+
const { lanesModel } = useLanes(() => viewedLaneId, !!targetLanesModel);
|
|
14
|
+
const targetModel = !lanesModel ? targetLanesModel : lanesModel;
|
|
15
|
+
return <LanesContext.Provider value={targetModel}>{children}</LanesContext.Provider>;
|
|
13
16
|
}
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,28 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/lanes.hooks.use-lanes",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.26",
|
|
4
4
|
"homepage": "https://bit.dev/teambit/lanes/hooks/use-lanes",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.lanes",
|
|
8
8
|
"name": "hooks/use-lanes",
|
|
9
|
-
"version": "0.0.
|
|
9
|
+
"version": "0.0.26"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"
|
|
13
|
-
"@teambit/
|
|
12
|
+
"core-js": "^3.0.0",
|
|
13
|
+
"@teambit/lanes.ui.models": "0.0.24",
|
|
14
|
+
"@teambit/scope.ui.hooks.use-scope": "0.0.228",
|
|
14
15
|
"@teambit/ui-foundation.ui.hooks.use-data-query": "0.0.496"
|
|
15
16
|
},
|
|
16
17
|
"devDependencies": {
|
|
17
|
-
"@types/react": "17.0.8",
|
|
18
|
+
"@types/react": "^17.0.8",
|
|
18
19
|
"@types/mocha": "9.1.0",
|
|
20
|
+
"@types/testing-library__jest-dom": "5.9.5",
|
|
19
21
|
"@babel/runtime": "7.12.18",
|
|
20
|
-
"@types/
|
|
21
|
-
"@types/
|
|
22
|
+
"@types/jest": "^26.0.0",
|
|
23
|
+
"@types/react-dom": "^17.0.5",
|
|
24
|
+
"@types/node": "12.20.4"
|
|
22
25
|
},
|
|
23
26
|
"peerDependencies": {
|
|
24
|
-
"
|
|
25
|
-
"
|
|
27
|
+
"@apollo/client": "^3.6.0",
|
|
28
|
+
"react-dom": "^16.8.0 || ^17.0.0",
|
|
29
|
+
"react": "^16.8.0 || ^17.0.0"
|
|
26
30
|
},
|
|
27
31
|
"license": "Apache-2.0",
|
|
28
32
|
"private": false,
|
|
File without changes
|
package/use-lanes.tsx
CHANGED
|
@@ -39,13 +39,14 @@ const GET_LANES = gql`
|
|
|
39
39
|
`;
|
|
40
40
|
|
|
41
41
|
export function useLanes(
|
|
42
|
-
getViewedLaneId?: () => string | undefined
|
|
42
|
+
getViewedLaneId?: () => string | undefined,
|
|
43
|
+
skip?: boolean
|
|
43
44
|
): { lanesModel?: LanesModel } & Omit<QueryResult<LanesQuery>, 'data'> {
|
|
44
45
|
const lanesContext = useLanesContext();
|
|
45
|
-
const
|
|
46
|
+
const shouldSkip = skip || !!lanesContext;
|
|
46
47
|
|
|
47
|
-
const { data, ...rest } = useDataQuery(GET_LANES, { skip });
|
|
48
|
-
const { scope, loading } = useScopeQuery(
|
|
48
|
+
const { data, ...rest } = useDataQuery(GET_LANES, { skip: shouldSkip });
|
|
49
|
+
const { scope, loading } = useScopeQuery(shouldSkip);
|
|
49
50
|
|
|
50
51
|
let lanesModel: LanesModel;
|
|
51
52
|
if (lanesContext) lanesModel = lanesContext;
|
|
Binary file
|