Skip to content

Commit 0884f0d

Browse files
Merge main into release
2 parents 15c36cc + 629919e commit 0884f0d

File tree

45 files changed

+185
-86
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+185
-86
lines changed

.changeset/khaki-numbers-nail.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@firebase/auth': patch
3+
'@firebase/util': minor
4+
---
5+
6+
Suppress the use of the `fetch` parameter `referrerPolicy` within Auth for `fetch` requests originating from Cloudflare Workers. Clouldflare Worker environments do not support this parameter and throw when it's used.

.changeset/warm-oranges-itch.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@firebase/firestore': patch
3+
---
4+
5+
Fix an issue with metadata `fromCache` defaulting to `true` when listening to cache in multi-tabs.

.github/workflows/test-all.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ jobs:
9292
- name: Run unit tests
9393
# Ignore auth and firestore since they're handled in their own separate jobs.
9494
run: |
95-
xvfb-run yarn lerna run --ignore '{firebase-messaging-integration-test,@firebase/auth*,@firebase/firestore*,firebase-firestore-integration-test}' --concurrency 4 test:ci
95+
xvfb-run yarn lerna run --ignore '{firebase-messaging-integration-test,@firebase/auth*,@firebase/firestore*,firebase-firestore-integration-test}' test:ci
9696
node scripts/print_test_logs.js
9797
env:
9898
FIREBASE_TOKEN: ${{ secrets.FIREBASE_CLI_TOKEN }}
@@ -142,7 +142,7 @@ jobs:
142142
run: echo "FIREBASE_CI_TEST_START_TIME=$(date +%s)" >> $GITHUB_ENV
143143
- name: Run unit tests
144144
run: |
145-
xvfb-run yarn lerna run --concurrency 4 test:ci --scope '@firebase/auth*'
145+
xvfb-run yarn lerna run test:ci --scope '@firebase/auth*'
146146
node scripts/print_test_logs.js
147147
env:
148148
FIREBASE_TOKEN: ${{ secrets.FIREBASE_CLI_TOKEN }}
@@ -182,7 +182,7 @@ jobs:
182182
run: echo "FIREBASE_CI_TEST_START_TIME=$(date +%s)" >> $GITHUB_ENV
183183
- name: Run unit tests
184184
run: |
185-
xvfb-run yarn lerna run --concurrency 4 test:ci --scope '@firebase/firestore*'
185+
xvfb-run yarn lerna run test:ci --scope '@firebase/firestore*'
186186
node scripts/print_test_logs.js
187187
env:
188188
FIREBASE_TOKEN: ${{ secrets.FIREBASE_CLI_TOKEN }}

common/api-review/util.api.md

+5
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,11 @@ export function isBrowser(): boolean;
264264
// @public (undocumented)
265265
export function isBrowserExtension(): boolean;
266266

267+
// Warning: (ae-missing-release-tag) "isCloudflareWorker" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
268+
//
269+
// @public
270+
export function isCloudflareWorker(): boolean;
271+
267272
// Warning: (ae-missing-release-tag) "isElectron" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
268273
//
269274
// @public

config/karma.base.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ const config = {
6666

6767
webpackMiddleware: { quiet: true, stats: { colors: true } },
6868

69-
singleRun: false,
69+
// Exit with an exit code of 0 if any of the tests fail.
70+
singleRun: true,
7071

7172
client: {
7273
mocha: {

integration/compat-interop/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"private": true,
44
"version": "0.1.0",
55
"scripts": {
6-
"test": "karma start --single-run",
6+
"test": "karma start",
77
"test:ci": "node ../../scripts/run_tests_in_ci.js -s test",
88
"test:debug": "karma start --browsers Chrome --auto-watch"
99
},

integration/firebase/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"private": true,
44
"version": "0.2.1",
55
"scripts": {
6-
"test": "karma start --single-run",
6+
"test": "karma start",
77
"test:ci": "node ../../scripts/run_tests_in_ci.js -s test"
88
},
99
"devDependencies": {

integration/firestore/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
"build:deps": "lerna run --scope @firebase/'{app,firestore}' --include-dependencies build",
77
"build:persistence": "INCLUDE_FIRESTORE_PERSISTENCE=true gulp compile-tests",
88
"build:memory": "INCLUDE_FIRESTORE_PERSISTENCE=false gulp compile-tests",
9-
"karma:singlerun": "karma start --single-run",
9+
"karma:singlerun": "karma start",
1010
"prettier": "prettier --write '*.js' '*.ts'",
11-
"test:persistence": " yarn build:persistence; karma start --single-run",
11+
"test:persistence": " yarn build:persistence; karma start",
1212
"test:persistence:debug": "yarn build:persistence; karma start --auto-watch --browsers Chrome",
13-
"test:memory": "yarn build:memory; karma start --single-run",
13+
"test:memory": "yarn build:memory; karma start",
1414
"test:memory:debug": "yarn build:memory; karma start --auto-watch --browsers Chrome"
1515
},
1616
"dependencies": {

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
"repl": "node tools/repl.js",
3131
"release": "ts-node-script scripts/release/cli.ts",
3232
"pretest": "node tools/pretest.js",
33-
"test": "lerna run --ignore firebase-messaging-integration-test --concurrency 4 --stream test",
34-
"test:ci": "lerna run --ignore firebase-messaging-integration-test --concurrency 4 test:ci",
33+
"test": "lerna run --ignore firebase-messaging-integration-test --stream test",
34+
"test:ci": "lerna run --ignore firebase-messaging-integration-test test:ci",
3535
"pretest:coverage": "mkdirp coverage",
3636
"ci:coverage": "lcov-result-merger 'packages/**/lcov.info' 'lcov-all.info'",
3737
"test:coverage": "lcov-result-merger 'packages/**/lcov.info' | coveralls",

packages/analytics-compat/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
"dev": "rollup -c -w",
4848
"test": "run-p --npm-path npm lint test:browser",
4949
"test:ci": "node ../../scripts/run_tests_in_ci.js -s test:browser",
50-
"test:browser": "karma start --single-run",
50+
"test:browser": "karma start",
5151
"test:browser:debug": "karma start --browsers=Chrome --auto-watch",
5252
"trusted-type-check": "tsec -p tsconfig.json --noEmit",
5353
"add-compat-overloads": "ts-node-script ../../scripts/build/create-overloads.ts -i ../analytics/dist/analytics-public.d.ts -o dist/src/index.d.ts -a -r Analytics:FirebaseAnalytics -r FirebaseApp:FirebaseAppCompat --moduleToEnhance @firebase/analytics"

packages/analytics/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
"test": "run-p --npm-path npm lint test:all",
3030
"test:all": "run-p --npm-path npm test:browser test:integration",
3131
"test:ci": "node ../../scripts/run_tests_in_ci.js -s test:all",
32-
"test:browser": "karma start --single-run --nocache",
33-
"test:integration": "karma start ./karma.integration.conf.js --single-run --nocache",
32+
"test:browser": "karma start --nocache",
33+
"test:integration": "karma start ./karma.integration.conf.js --nocache",
3434
"trusted-type-check": "tsec -p tsconfig.json --noEmit",
3535
"api-report": "api-extractor run --local --verbose",
3636
"doc": "api-documenter markdown --input temp --output docs",

packages/app-check-compat/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"dev": "rollup -c -w",
2929
"test": "run-p --npm-path npm lint test:browser",
3030
"test:ci": "node ../../scripts/run_tests_in_ci.js -s test:browser",
31-
"test:browser": "karma start --single-run --nocache",
31+
"test:browser": "karma start --nocache",
3232
"trusted-type-check": "tsec -p tsconfig.json --noEmit",
3333
"add-compat-overloads": "ts-node-script ../../scripts/build/create-overloads.ts -i ../app-check/dist/app-check-public.d.ts -o dist/src/index.d.ts -a -r AppCheck:FirebaseAppCheck -r FirebaseApp:FirebaseAppCompat --moduleToEnhance @firebase/app-check"
3434
},

packages/app-check/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"dev": "rollup -c -w",
2929
"test": "run-p --npm-path npm lint test:browser",
3030
"test:ci": "node ../../scripts/run_tests_in_ci.js -s test:browser",
31-
"test:browser": "karma start --single-run --nocache",
31+
"test:browser": "karma start --nocache",
3232
"trusted-type-check": "tsec -p tsconfig.json --noEmit",
3333
"api-report": "api-extractor run --local --verbose",
3434
"doc": "api-documenter markdown --input temp --output docs",

packages/app-compat/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"test": "run-p --npm-path npm lint test:all",
3333
"test:all": "run-p --npm-path npm test:browser test:node",
3434
"test:ci": "node ../../scripts/run_tests_in_ci.js -s test:all",
35-
"test:browser": "karma start --single-run",
35+
"test:browser": "karma start",
3636
"test:browser:debug": "karma start --browsers Chrome --auto-watch",
3737
"test:node": "TS_NODE_FILES=true TS_NODE_CACHE=NO TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' nyc --reporter lcovonly -- mocha test/**/*.test.* src/**/*.test.ts --config ../../config/mocharc.node.js",
3838
"trusted-type-check": "tsec -p tsconfig.json --noEmit",

packages/app/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"test": "run-p --npm-path npm lint test:all",
3030
"test:ci": "node ../../scripts/run_tests_in_ci.js -s test:all",
3131
"test:all": "run-p --npm-path npm test:browser test:node",
32-
"test:browser": "karma start --single-run",
32+
"test:browser": "karma start",
3333
"test:node": "TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' nyc --reporter lcovonly -- mocha src/**/*.test.ts --config ../../config/mocharc.node.js",
3434
"trusted-type-check": "tsec -p tsconfig.json --noEmit",
3535
"api-report": "api-extractor run --local --verbose",

packages/auth-compat/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@
3737
"test": "run-p --npm-path npm lint test:all",
3838
"test:all": "run-p --npm-path npm test:browser test:node test:integration",
3939
"test:ci": "node ../../scripts/run_tests_in_ci.js -s test:all",
40-
"test:browser": "karma start --single-run",
41-
"test:browser:unit": "karma start --single-run --unit",
42-
"test:browser:integration": "karma start --single-run --integration",
40+
"test:browser": "karma start",
41+
"test:browser:unit": "karma start --unit",
42+
"test:browser:integration": "karma start --integration",
4343
"test:node": "ts-node -O '{\"module\": \"commonjs\", \"target\": \"es6\"}' scripts/run_node_tests.ts",
4444
"test:node:integration": "ts-node -O '{\"module\": \"commonjs\", \"target\": \"es6\"}' scripts/run_node_tests.ts --integration",
4545
"test:webdriver": "rollup -c test/integration/webdriver/static/rollup.config.js && ts-node -O '{\"module\": \"commonjs\", \"target\": \"es6\"}' scripts/run_node_tests.ts --webdriver",

packages/auth/package.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,14 @@
9797
"test:integration": "firebase emulators:exec --project emulatedproject --only auth \"run-s --npm-path npm test:browser:integration:local test:node:integration:local test:webdriver\"",
9898
"test:ci": "node ../../scripts/run_tests_in_ci.js -s test:all",
9999
"test:integration:local": "run-s --npm-path npm test:node:integration:local test:browser:integration:local test:webdriver",
100-
"test:browser": "karma start --single-run --local",
101-
"test:browser:unit": "karma start --single-run --unit",
102-
"test:browser:integration": "karma start --single-run --integration",
103-
"test:browser:integration:local": "karma start --single-run --integration --local",
104-
"test:browser:integration:prodbackend": "karma start --single-run --integration --prodbackend",
100+
"test:browser": "karma start --local",
101+
"test:browser:unit": "karma start --unit",
102+
"test:browser:integration": "karma start --integration",
103+
"test:browser:integration:local": "karma start --integration --local",
104+
"test:browser:integration:prodbackend": "karma start --integration --prodbackend",
105105
"test:browser:debug": "karma start --auto-watch",
106106
"test:browser:unit:debug": "karma start --auto-watch --unit",
107-
"test:cordova": "karma start --single-run --cordova",
107+
"test:cordova": "karma start --cordova",
108108
"test:cordova:debug": "karma start --auto-watch --cordova",
109109
"test:node": "run-s --npm-path npm test:node:unit test:node:integration:local",
110110
"test:node:unit": "ts-node -O '{\"module\": \"commonjs\", \"target\": \"es6\"}' scripts/run_node_tests.ts",

packages/auth/src/api/index.test.ts

+47
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import { useFakeTimers } from 'sinon';
2222
import sinonChai from 'sinon-chai';
2323

2424
import { FirebaseError, getUA } from '@firebase/util';
25+
import * as utils from '@firebase/util';
2526

2627
import { mockEndpoint } from '../../test/helpers/api/helper';
2728
import { testAuth, TestAuth } from '../../test/helpers/mock_auth';
@@ -308,6 +309,52 @@ describe('api/_performApiRequest', () => {
308309
});
309310
});
310311

312+
context('referer policy exists on fetch request', () => {
313+
afterEach(mockFetch.tearDown);
314+
315+
it('should have referrerPolicy set', async () => {
316+
let referrerPolicySet: boolean = false;
317+
mockFetch.setUpWithOverride(
318+
(input: RequestInfo | URL, request?: RequestInit) => {
319+
if (request !== undefined && request.referrerPolicy !== undefined) {
320+
referrerPolicySet = true;
321+
}
322+
return Promise.resolve(new Response(JSON.stringify(serverResponse)));
323+
}
324+
);
325+
const promise = _performApiRequest<typeof request, typeof serverResponse>(
326+
auth,
327+
HttpMethod.POST,
328+
Endpoint.SIGN_UP,
329+
request
330+
);
331+
await expect(promise).to.be.fulfilled;
332+
expect(referrerPolicySet).to.be.true;
333+
});
334+
335+
it('should not have referrerPolicy set on Cloudflare workers', async () => {
336+
sinon.stub(utils, 'isCloudflareWorker').returns(true);
337+
let referrerPolicySet: boolean = false;
338+
mockFetch.setUpWithOverride(
339+
(input: RequestInfo | URL, request?: RequestInit) => {
340+
if (request !== undefined && request.referrerPolicy !== undefined) {
341+
referrerPolicySet = true;
342+
}
343+
return Promise.resolve(new Response(JSON.stringify(serverResponse)));
344+
}
345+
);
346+
const promise = _performApiRequest<typeof request, typeof serverResponse>(
347+
auth,
348+
HttpMethod.POST,
349+
Endpoint.SIGN_UP,
350+
request
351+
);
352+
await expect(promise).to.be.fulfilled;
353+
expect(referrerPolicySet).to.be.false;
354+
sinon.restore();
355+
});
356+
});
357+
311358
context('with network issues', () => {
312359
afterEach(mockFetch.tearDown);
313360

packages/auth/src/api/index.ts

+16-7
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* limitations under the License.
1616
*/
1717

18-
import { FirebaseError, querystring } from '@firebase/util';
18+
import { FirebaseError, isCloudflareWorker, querystring } from '@firebase/util';
1919

2020
import { AuthErrorCode, NamedErrorParams } from '../core/errors';
2121
import {
@@ -148,14 +148,23 @@ export async function _performApiRequest<T, V>(
148148
headers[HttpHeader.X_FIREBASE_LOCALE] = auth.languageCode;
149149
}
150150

151+
const fetchArgs: RequestInit = {
152+
method,
153+
headers,
154+
...body
155+
};
156+
157+
/* Security-conscious server-side frameworks tend to have built in mitigations for referrer
158+
problems". See the Cloudflare GitHub issue #487: Error: The 'referrerPolicy' field on
159+
'RequestInitializerDict' is not implemented."
160+
https://github.com/cloudflare/next-on-pages/issues/487 */
161+
if (!isCloudflareWorker()) {
162+
fetchArgs.referrerPolicy = 'no-referrer';
163+
}
164+
151165
return FetchProvider.fetch()(
152166
_getFinalTarget(auth, auth.config.apiHost, path, query),
153-
{
154-
method,
155-
headers,
156-
referrerPolicy: 'no-referrer',
157-
...body
158-
}
167+
fetchArgs
159168
);
160169
});
161170
}

packages/component/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"test": "run-p --npm-path npm lint test:all",
2929
"test:all": "run-p --npm-path npm test:browser test:node",
3030
"test:ci": "node ../../scripts/run_tests_in_ci.js -s test:all",
31-
"test:browser": "karma start --single-run",
31+
"test:browser": "karma start",
3232
"test:node": "TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' nyc --reporter lcovonly -- mocha src/**/*.test.ts --config ../../config/mocharc.node.js",
3333
"trusted-type-check": "tsec -p tsconfig.json --noEmit"
3434
},

packages/database-compat/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
"dev": "rollup -c -w",
4646
"test": "run-p --npm-path npm lint test:browser test:node",
4747
"test:ci": "node ../../scripts/run_tests_in_ci.js -s test",
48-
"test:browser": "karma start --single-run",
48+
"test:browser": "karma start",
4949
"test:node": "TS_NODE_FILES=true TS_NODE_CACHE=NO TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' nyc --reporter lcovonly -- mocha 'test/{,!(browser)/**/}*.test.ts' --file src/index.node.ts --config ../../config/mocharc.node.js",
5050
"trusted-type-check": "tsec -p tsconfig.json --noEmit",
5151
"add-compat-overloads": "ts-node-script ../../scripts/build/create-overloads.ts -i ../database/dist/public.d.ts -o dist/database-compat/src/index.d.ts -a -r Database:types.FirebaseDatabase -r Query:types.Query -r DatabaseReference:types.Reference -r FirebaseApp:FirebaseAppCompat --moduleToEnhance @firebase/database"

packages/database/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"test": "run-p --npm-path npm lint test:emulator",
3939
"test:ci": "node ../../scripts/run_tests_in_ci.js -s test:emulator",
4040
"test:all": "run-p --npm-path npm lint test:browser test:node",
41-
"test:browser": "karma start --single-run",
41+
"test:browser": "karma start",
4242
"test:node": "TS_NODE_FILES=true TS_NODE_CACHE=NO TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' nyc --reporter lcovonly -- mocha 'test/{,!(browser)/**/}*.test.ts' --file src/index.node.ts --config ../../config/mocharc.node.js",
4343
"test:emulator": "ts-node --compiler-options='{\"module\":\"commonjs\"}' ../../scripts/emulator-testing/database-test-runner.ts",
4444
"trusted-type-check": "tsec -p tsconfig.json --noEmit",

packages/firestore-compat/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"test": "run-s --npm-path npm lint test:all",
4040
"test:ci": "node ../../scripts/run_tests_in_ci.js -s test:all",
4141
"test:all": "run-p --npm-path npm test:browser test:node",
42-
"test:browser": "karma start --single-run",
42+
"test:browser": "karma start",
4343
"test:node": "mocha --require babel-register.js --require src/index.node.ts --timeout 5000 'test/*.test.ts'",
4444
"trusted-type-check": "tsec -p tsconfig.json --noEmit",
4545
"add-compat-overloads": "ts-node-script ../../scripts/build/create-overloads.ts -i ../firestore/dist/index.d.ts -o dist/src/index.d.ts -a -r Firestore:types.FirebaseFirestore -r CollectionReference:types.CollectionReference -r DocumentReference:types.DocumentReference -r Query:types.Query -r FirebaseApp:FirebaseAppCompat --moduleToEnhance @firebase/firestore"

packages/firestore/package.json

+8-8
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,20 @@
2424
"test:lite": "ts-node ./scripts/run-tests.ts --emulator --platform node_lite --main=lite/index.ts 'test/lite/**/*.test.ts'",
2525
"test:lite:prod": "ts-node ./scripts/run-tests.ts --platform node_lite --main=lite/index.ts 'test/lite/**/*.test.ts'",
2626
"test:lite:prod:nameddb": "ts-node ./scripts/run-tests.ts --platform node_lite --databaseId=test-db --main=lite/index.ts 'test/lite/**/*.test.ts'",
27-
"test:lite:browser": "karma start --single-run --lite",
28-
"test:lite:browser:nameddb": "karma start --single-run --lite --databaseId=test-db",
27+
"test:lite:browser": "karma start --lite",
28+
"test:lite:browser:nameddb": "karma start --lite --databaseId=test-db",
2929
"test:lite:browser:debug": "karma start --browsers=Chrome --lite --auto-watch",
3030
"test": "run-s --npm-path npm lint test:all",
3131
"test:ci": "node ../../scripts/run_tests_in_ci.js -s test:all:ci",
3232
"test:all:ci": "run-s --npm-path npm test:browser test:travis test:lite:browser test:browser:prod:nameddb test:lite:browser:nameddb",
3333
"test:all": "run-p --npm-path npm test:browser test:lite:browser test:travis test:minified test:browser:prod:nameddb test:lite:browser:nameddb",
34-
"test:browser": "karma start --single-run",
34+
"test:browser": "karma start",
3535
"test:browser:emulator:debug": "karma start --browsers=Chrome --targetBackend=emulator",
36-
"test:browser:emulator": "karma start --single-run --targetBackend=emulator",
37-
"test:browser:nightly": "karma start --single-run --targetBackend=nightly",
38-
"test:browser:prod": "karma start --single-run --targetBackend=prod",
39-
"test:browser:prod:nameddb": "karma start --single-run --targetBackend=prod --databaseId=test-db",
40-
"test:browser:unit": "karma start --single-run --unit",
36+
"test:browser:emulator": "karma start --targetBackend=emulator",
37+
"test:browser:nightly": "karma start --targetBackend=nightly",
38+
"test:browser:prod": "karma start --targetBackend=prod",
39+
"test:browser:prod:nameddb": "karma start --targetBackend=prod --databaseId=test-db",
40+
"test:browser:unit": "karma start --unit",
4141
"test:browser:debug": "karma start --browsers=Chrome --auto-watch",
4242
"test:node": "ts-node ./scripts/run-tests.ts --main=test/register.ts --emulator 'test/{,!(browser|lite)/**/}*.test.ts'",
4343
"test:node:prod": "ts-node ./scripts/run-tests.ts --main=test/register.ts 'test/{,!(browser|lite)/**/}*.test.ts'",

packages/firestore/src/core/sync_engine_impl.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -353,9 +353,11 @@ async function allocateTargetAndMaybeListen(
353353
// not registering it in shared client state, and directly calculate initial snapshots and
354354
// subsequent updates from cache. Otherwise, register the target ID with local Firestore client
355355
// as active watch target.
356-
const status: QueryTargetState = shouldListenToRemote
357-
? syncEngineImpl.sharedClientState.addLocalQueryTarget(targetId)
358-
: 'not-current';
356+
const status: QueryTargetState =
357+
syncEngineImpl.sharedClientState.addLocalQueryTarget(
358+
targetId,
359+
/* addToActiveTargetIds= */ shouldListenToRemote
360+
);
359361

360362
let viewSnapshot;
361363
if (shouldInitializeView) {

0 commit comments

Comments
 (0)