Skip to content

Commit

Permalink
Fix feature flags in compiler explorer (#4828)
Browse files Browse the repository at this point in the history
Summary:
We (I) forgot to update the feature flags in the compiler explorer when we removed `enable_catch_directive_transform`.

This also fixes a bug where we did not deserialize feature flags from the url correctly.

https://github.com/user-attachments/assets/012abecc-3ef0-4072-addd-3ba8eb2a143e

Pull Request resolved: #4828

Reviewed By: gordyf

Differential Revision: D64720268

Pulled By: captbaritone

fbshipit-source-id: a8916442f7ca47dde8109e837aa67c165f916302
  • Loading branch information
captbaritone authored and facebook-github-bot committed Oct 22, 2024
1 parent 6ae12c4 commit 96a4dd7
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 12 deletions.
4 changes: 2 additions & 2 deletions compiler/crates/common/src/feature_flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,10 @@ pub struct FeatureFlags {

/// Skip the optimization which extracts common JavaScript structures in
/// generated artifacts into numbered variables and uses them by reference
/// in each position in which they occure.
/// in each position in which they occur.
///
/// This optimization can make it hard to follow changes to generated
/// code, so being able to disable it can be helpful for debgging.
/// code, so being able to disable it can be helpful for debugging.
///
/// To disable deduping for just one fragment or operation's generated
/// artifacts:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@
]
},
"disable_deduping_common_structures_in_artifacts": {
"description": "Skip the optimization which extracts common JavaScript structures in generated artifacts into numbered variables and uses them by reference in each position in which they occure.\n\nThis optimization can make it hard to follow changes to generated code, so being able to disable it can be helpful for debgging.\n\nTo disable deduping for just one fragment or operation's generated artifacts:\n\n```json \"disable_deduping_common_structures_in_artifacts\": { { \"kind\": \"limited\", \"allowList\": [\"<operation_or_fragment_name>\"] } } ```",
"description": "Skip the optimization which extracts common JavaScript structures in generated artifacts into numbered variables and uses them by reference in each position in which they occur.\n\nThis optimization can make it hard to follow changes to generated code, so being able to disable it can be helpful for debugging.\n\nTo disable deduping for just one fragment or operation's generated artifacts:\n\n```json \"disable_deduping_common_structures_in_artifacts\": { { \"kind\": \"limited\", \"allowList\": [\"<operation_or_fragment_name>\"] } } ```",
"default": {
"kind": "disabled"
},
Expand Down Expand Up @@ -2442,7 +2442,7 @@
]
},
"disable_deduping_common_structures_in_artifacts": {
"description": "Skip the optimization which extracts common JavaScript structures in generated artifacts into numbered variables and uses them by reference in each position in which they occure.\n\nThis optimization can make it hard to follow changes to generated code, so being able to disable it can be helpful for debgging.\n\nTo disable deduping for just one fragment or operation's generated artifacts:\n\n```json \"disable_deduping_common_structures_in_artifacts\": { { \"kind\": \"limited\", \"allowList\": [\"<operation_or_fragment_name>\"] } } ```",
"description": "Skip the optimization which extracts common JavaScript structures in generated artifacts into numbered variables and uses them by reference in each position in which they occur.\n\nThis optimization can make it hard to follow changes to generated code, so being able to disable it can be helpful for debugging.\n\nTo disable deduping for just one fragment or operation's generated artifacts:\n\n```json \"disable_deduping_common_structures_in_artifacts\": { { \"kind\": \"limited\", \"allowList\": [\"<operation_or_fragment_name>\"] } } ```",
"default": {
"kind": "disabled"
},
Expand Down Expand Up @@ -3991,7 +3991,7 @@
]
},
"disable_deduping_common_structures_in_artifacts": {
"description": "Skip the optimization which extracts common JavaScript structures in generated artifacts into numbered variables and uses them by reference in each position in which they occure.\n\nThis optimization can make it hard to follow changes to generated code, so being able to disable it can be helpful for debgging.\n\nTo disable deduping for just one fragment or operation's generated artifacts:\n\n```json \"disable_deduping_common_structures_in_artifacts\": { { \"kind\": \"limited\", \"allowList\": [\"<operation_or_fragment_name>\"] } } ```",
"description": "Skip the optimization which extracts common JavaScript structures in generated artifacts into numbered variables and uses them by reference in each position in which they occur.\n\nThis optimization can make it hard to follow changes to generated code, so being able to disable it can be helpful for debugging.\n\nTo disable deduping for just one fragment or operation's generated artifacts:\n\n```json \"disable_deduping_common_structures_in_artifacts\": { { \"kind\": \"limited\", \"allowList\": [\"<operation_or_fragment_name>\"] } } ```",
"default": {
"kind": "disabled"
},
Expand Down
6 changes: 0 additions & 6 deletions website/src/compiler-explorer/ExplorerStateConstants.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,6 @@ export const FEATURE_FLAGS = [
kind: 'enum',
default: true,
},
{
key: 'enable_catch_directive_transform',
label: '@catch',
kind: 'enum',
default: false,
},
];

export const DEFAULT_STATE = {
Expand Down
5 changes: 4 additions & 1 deletion website/src/compiler-explorer/ExplorerStateSerialization.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ export function serializeState(state) {
// If we ever have a feature flag which conflicts with a top-level state value
// we will need to find a way to deal with that. However, it's unlikely
// and it makes the URL easier to read.
//
// Note: URLSearchParam values are always strings, so this will be "true" or "false".
params.set(flag, enabled);
}
} else {
Expand All @@ -52,7 +54,8 @@ export function deserializeState(params) {
} else if (key == 'featureFlags') {
const featureFlags = {};
for (const {key} of FEATURE_FLAGS) {
featureFlags[key] = Boolean(params.get(key));
// Decode string boolean values into boolean.
featureFlags[key] = params.get(key) === 'true';
}
state[key] = featureFlags;
} else {
Expand Down

0 comments on commit 96a4dd7

Please sign in to comment.