Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DX: Split out feature flags from the Me user data endpoint #7734

Merged
merged 39 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from 35 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
4138169
split out feature flags from Me endpoint
Feb 26, 2024
d15a213
add new file to null checks
Feb 26, 2024
bbdb775
fix tests
Feb 26, 2024
ac07b18
Update src/auth/featureFlags.ts
BLoe Feb 26, 2024
50497ba
add comment back
Feb 26, 2024
a1c8002
clean up
Feb 26, 2024
6f3232e
Merge branch 'main' into dev/separate-feature-flags-from-me
Feb 26, 2024
cf7c920
add tests
Feb 26, 2024
ca10d9d
add test file to null checks
Feb 26, 2024
cb0efeb
some pr feedback
Feb 26, 2024
28d8a57
reset feature flags on auth change
Feb 26, 2024
4d7ce7c
make sure flag is cleared
Feb 26, 2024
8df4923
convert to use webext-storage-cache
Feb 26, 2024
f37b441
fix jest config, fix storage override, update snapshots
Feb 27, 2024
5c08bbf
Merge branch 'main' into dev/separate-feature-flags-from-me
Feb 27, 2024
075ae2c
package lock changes?
Feb 27, 2024
d03a9cd
Merge branch 'main' into dev/separate-feature-flags-from-me
Feb 27, 2024
353ad78
move feature flag fetch to background, and add useFlags tests
Feb 27, 2024
692ccae
fix manifest snapshot
Feb 27, 2024
cfa8038
fix package lock
Feb 27, 2024
f725676
Merge branch 'main' into dev/separate-feature-flags-from-me
Feb 27, 2024
6334c27
Fix package lock
twschiller Feb 27, 2024
029b063
Fix package lock
twschiller Feb 27, 2024
d60d1e5
Add CI check
fregante Feb 28, 2024
e30fa32
Add unique identifiers
fregante Feb 28, 2024
c665d5e
restore lockfile
fregante Feb 28, 2024
3805446
/2
fregante Feb 28, 2024
c43f52f
Automatically hide comment once resolved
fregante Feb 28, 2024
a97c0d2
Test strictNullChecks CI check for messenger
fregante Feb 28, 2024
21b72f6
Drop CI workflows from this PR, move to their own PRs
fregante Feb 28, 2024
912f6db
`fetchFeatureFlags` - Use readonly array
fregante Feb 28, 2024
c0984ff
`fetchFeatureFlags` - Drop redundant HTTP status check
fregante Feb 28, 2024
41eb983
Merge branch 'main' into dev/separate-feature-flags-from-me
Feb 28, 2024
122ac10
remove maxAge/expiry timeouts
Feb 28, 2024
7e68a8c
Merge branch 'main' into dev/separate-feature-flags-from-me
Feb 28, 2024
8a9e055
package lock
Feb 28, 2024
4514895
fix strict null checks with messenger call
Feb 28, 2024
4ac6617
remove test function
Feb 28, 2024
cf173f2
fix import and add file to null checks
Feb 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions eslint-local-rules/persistBackgroundData.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@
./src/analysis/analysisVisitors/regexAnalysis.ts
./src/analysis/analysisVisitors/varAnalysis/varMap.ts
./src/auth/authConstants.ts
./src/auth/authStorage.ts
./src/auth/authTypes.ts
./src/auth/authUtils.ts
./src/auth/token.ts
./src/auth/featureFlags.ts
./src/components/annotationAlert/FieldAnnotationAlert.tsx
./src/components/AsyncButton.tsx
./src/components/DelayedRender.tsx
Expand Down Expand Up @@ -255,7 +256,6 @@
./src/store/settings/settingsStorage.ts
./src/store/settings/settingsTypes.ts
./src/store/StorageInterface.ts
./src/store/syncFlags.ts
./src/telemetry/BackgroundLogger.ts
./src/telemetry/deployments.ts
./src/telemetry/dnt.ts
Expand Down
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const config = {
"^.+\\.txt$": "<rootDir>/src/testUtils/rawJestTransformer.mjs",
},
transformIgnorePatterns: [
"node_modules/(?!@cfworker|escape-string-regex|filename-reserved-regex|filenamify|idb|webext-|p-timeout|p-retry|p-defer|p-memoize|serialize-error|strip-outer|trim-repeated|mimic-fn|urlpattern-polyfill|url-join|uuid|nanoid|use-debounce|copy-text-to-clipboard|linkify-urls|create-html-element|stringify-attributes|escape-goat|stemmer|uint8array-extras|one-event|abort-utils|batched-function|is-network-error|text-field-edit)",
"node_modules/(?!@cfworker|escape-string-regex|filename-reserved-regex|filenamify|idb|webext-|p-timeout|p-retry|p-defer|p-memoize|serialize-error|strip-outer|trim-repeated|mimic-fn|urlpattern-polyfill|url-join|uuid|nanoid|use-debounce|copy-text-to-clipboard|linkify-urls|create-html-element|stringify-attributes|escape-goat|stemmer|uint8array-extras|one-event|abort-utils|batched-function|is-network-error|text-field-edit|webext-storage-cache|@sindresorhus/to-milliseconds)",
],
setupFiles: [
"dotenv/config",
Expand Down
239 changes: 235 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@
"webext-permissions": "^3.1.2",
"webext-polyfill-kinda": "^1.0.2",
"webext-storage": "^1.2.2",
"webext-storage-cache": "^6.0.0",
"webext-tools": "^1.2.3",
"webextension-polyfill": "^0.10.0",
"whatwg-mimetype": "^4.0.0",
Expand Down
2 changes: 2 additions & 0 deletions scripts/__snapshots__/manifest.test.js.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/auth/RequireAuth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import React, { useEffect } from "react";
import { useDispatch, useSelector } from "react-redux";
import Loader from "@/components/Loader";
import { useGetMeQuery } from "@/data/service/api";
import { clearCachedAuthSecrets, updateUserData } from "@/auth/token";
import { clearCachedAuthSecrets, updateUserData } from "@/auth/authStorage";
import {
selectExtensionAuthState,
selectUserDataUpdate,
Expand Down
1 change: 0 additions & 1 deletion src/auth/authConstants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ export const anonAuth: AuthState = Object.freeze({
isTestAccount: false,
extension: true,
scope: null,
flags: [],
milestones: [],
organizations: [],
groups: [],
Expand Down
1 change: 0 additions & 1 deletion src/auth/authSelectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export const selectAuth = (state: AuthRootState) => state.auth;
export const selectIsLoggedIn = (state: AuthRootState) =>
selectAuth(state).isLoggedIn;
export const selectScope = (state: AuthRootState) => selectAuth(state).scope;
export const selectFlags = (state: AuthRootState) => selectAuth(state).flags;
export const selectMilestones = (state: AuthRootState) =>
selectAuth(state).milestones;
export const selectOrganizations = (state: AuthRootState) =>
Expand Down
1 change: 0 additions & 1 deletion src/auth/authSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export const authSlice = createSlice({
return {
...payload,
scope: isEmpty(payload.scope) ? null : payload.scope,
flags: Array.isArray(payload.flags) ? payload.flags : [],
organizations: Array.isArray(payload.organizations)
? payload.organizations
: [],
Expand Down
6 changes: 6 additions & 0 deletions src/auth/token.ts → src/auth/authStorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ export function removeListener(handler: AuthListener): void {
authChanges.remove(handler);
}

export function onUserAuthChangedHandler(
handler: () => void | Promise<void>,
): AuthListener {
return (auth) => {};
}

function triggerListeners(
auth: Partial<TokenAuthData | PartnerAuthData>,
): void {
Expand Down