@tramvai/module-child-app 2.112.0 → 2.117.2

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.
@@ -48,11 +48,11 @@ const browserProviders = [
48
48
  provide: commandLineListTokens.resolvePageDeps,
49
49
  multi: true,
50
50
  useFactory: ({ preloader }) => {
51
- let hasCalled = false;
51
+ let isSpaNavigation = false;
52
52
  return function childAppRunPreloaded() {
53
- if (hasCalled)
53
+ if (isSpaNavigation)
54
54
  return;
55
- hasCalled = true;
55
+ isSpaNavigation = true;
56
56
  return preloader.runPreloaded();
57
57
  };
58
58
  },
@@ -83,6 +83,7 @@ const browserProviders = [
83
83
  preloader,
84
84
  runner,
85
85
  status: 'spa',
86
+ forcePreload: false,
86
87
  });
87
88
  };
88
89
  },
@@ -100,6 +101,7 @@ const browserProviders = [
100
101
  preloader,
101
102
  runner,
102
103
  status: 'afterSpa',
104
+ forcePreload: true,
103
105
  });
104
106
  };
105
107
  },
@@ -1,6 +1,10 @@
1
- const runCommand = async ({ status, runner, preloader, }) => {
1
+ const runCommand = async ({ status, forcePreload, runner, preloader, }) => {
2
2
  const childApps = preloader.getPreloadedList();
3
- await Promise.all(childApps.map((config) => {
3
+ await Promise.all(childApps.map(async (config) => {
4
+ if (forcePreload) {
5
+ // need to wait while actual child-app is loaded in case it wasn't preloaded before
6
+ await preloader.preload(config);
7
+ }
4
8
  return runner.run('client', status, config);
5
9
  }));
6
10
  };
@@ -1,6 +1,7 @@
1
1
  import type { CHILD_APP_COMMAND_LINE_RUNNER_TOKEN, CHILD_APP_PRELOAD_MANAGER_TOKEN } from '@tramvai/tokens-child-app';
2
- export declare const runCommand: ({ status, runner, preloader, }: {
2
+ export declare const runCommand: ({ status, forcePreload, runner, preloader, }: {
3
3
  status: string;
4
+ forcePreload: boolean;
4
5
  runner: typeof CHILD_APP_COMMAND_LINE_RUNNER_TOKEN;
5
6
  preloader: typeof CHILD_APP_PRELOAD_MANAGER_TOKEN;
6
7
  }) => Promise<void>;
@@ -34,8 +34,13 @@ const pagePreloadProviders = [
34
34
  provide({
35
35
  provide: commandLineListTokens.resolvePageDeps,
36
36
  useFactory: (deps) => {
37
+ let isSpaNavigation = false;
37
38
  return function preloadChildApps() {
38
- return pagePreload(deps);
39
+ const promise = pagePreload(deps);
40
+ if (!isSpaNavigation) {
41
+ isSpaNavigation = true;
42
+ return promise;
43
+ }
39
44
  };
40
45
  },
41
46
  multi: true,
@@ -34,8 +34,13 @@ const pagePreloadProviders = [
34
34
  provide({
35
35
  provide: commandLineListTokens.resolvePageDeps,
36
36
  useFactory: (deps) => {
37
+ let isSpaNavigation = false;
37
38
  return function preloadChildApps() {
38
- return pagePreload(deps);
39
+ const promise = pagePreload(deps);
40
+ if (!isSpaNavigation) {
41
+ isSpaNavigation = true;
42
+ return promise;
43
+ }
39
44
  };
40
45
  },
41
46
  multi: true,
@@ -38,8 +38,13 @@ const pagePreloadProviders = [
38
38
  core.provide({
39
39
  provide: core.commandLineListTokens.resolvePageDeps,
40
40
  useFactory: (deps) => {
41
+ let isSpaNavigation = false;
41
42
  return function preloadChildApps() {
42
- return pagePreload(deps);
43
+ const promise = pagePreload(deps);
44
+ if (!isSpaNavigation) {
45
+ isSpaNavigation = true;
46
+ return promise;
47
+ }
43
48
  };
44
49
  },
45
50
  multi: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tramvai/module-child-app",
3
- "version": "2.112.0",
3
+ "version": "2.117.2",
4
4
  "description": "Module for child apps",
5
5
  "browser": {
6
6
  "./lib/server.js": "./lib/browser.js",
@@ -28,24 +28,24 @@
28
28
  },
29
29
  "dependencies": {
30
30
  "@tinkoff/env-validators": "0.1.6",
31
- "@tinkoff/module-loader-client": "0.4.8",
31
+ "@tinkoff/module-loader-client": "0.4.9",
32
32
  "@tinkoff/module-loader-server": "0.5.12",
33
33
  "@tinkoff/url": "0.8.6",
34
- "@tramvai/child-app-core": "2.112.0",
34
+ "@tramvai/child-app-core": "2.117.2",
35
35
  "@tramvai/safe-strings": "0.5.9",
36
- "@tramvai/tokens-child-app": "2.112.0"
36
+ "@tramvai/tokens-child-app": "2.117.2"
37
37
  },
38
38
  "devDependencies": {},
39
39
  "peerDependencies": {
40
40
  "@tinkoff/dippy": "0.8.15",
41
41
  "@tinkoff/router": "0.2.17",
42
42
  "@tinkoff/utils": "^2.1.2",
43
- "@tramvai/core": "2.112.0",
44
- "@tramvai/state": "2.112.0",
45
- "@tramvai/react": "2.112.0",
46
- "@tramvai/tokens-common": "2.112.0",
47
- "@tramvai/tokens-render": "2.112.0",
48
- "@tramvai/tokens-router": "2.112.0",
43
+ "@tramvai/core": "2.117.2",
44
+ "@tramvai/state": "2.117.2",
45
+ "@tramvai/react": "2.117.2",
46
+ "@tramvai/tokens-common": "2.117.2",
47
+ "@tramvai/tokens-render": "2.117.2",
48
+ "@tramvai/tokens-router": "2.117.2",
49
49
  "react": ">=16.14.0",
50
50
  "react-dom": ">=16.14.0",
51
51
  "object-assign": "^4.1.1",