Skip to content

Commit 55f3ed6

Browse files
committed
ENG-1454: Enable dual read feature flag
1 parent a8420de commit 55f3ed6

4 files changed

Lines changed: 19 additions & 5 deletions

File tree

apps/roam/src/components/settings/AdminPanel.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import deleteBlock from "roamjs-components/writes/deleteBlock";
3939
import { USE_REIFIED_RELATIONS } from "~/data/userSettings";
4040
import posthog from "posthog-js";
4141
import { setFeatureFlag } from "~/components/settings/utils/accessors";
42+
import { FeatureFlagPanel } from "./components/BlockPropSettingPanels";
4243

4344
const NodeRow = ({ node }: { node: PConceptFull }) => {
4445
return (
@@ -467,6 +468,12 @@ const FeatureFlagsTab = (): React.ReactElement => {
467468
}
468469
/>
469470

471+
<FeatureFlagPanel
472+
title="Enable dual read"
473+
description="When enabled, accessor getters read from block props instead of the old system. Surfaces dual-write gaps during development."
474+
featureKey="Enable dual read"
475+
/>
476+
470477
<Button
471478
className="w-96"
472479
icon="send-message"

apps/roam/src/components/settings/utils/pullWatchers.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,13 @@ export const featureFlagHandlers: Partial<
9090
(newValue: boolean, oldValue: boolean, allFlags: FeatureFlags) => void
9191
>
9292
> = {
93-
// Add handlers as needed:
94-
// "Enable Left Sidebar": (newValue) => { ... },
95-
// "Suggestive Mode Enabled": (newValue) => { ... },
96-
// "Reified Relation Triples": (newValue) => { ... },
93+
/* eslint-disable @typescript-eslint/naming-convention */
94+
"Enable dual read": (newValue, oldValue) => {
95+
console.log(
96+
`[DG] Enable dual read: ${String(oldValue)}${String(newValue)}`,
97+
);
98+
},
99+
/* eslint-enable @typescript-eslint/naming-convention */
97100
};
98101

99102
type GlobalSettingsHandlers = {

apps/roam/src/components/settings/utils/zodSchema.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ export const FeatureFlagsSchema = z.object({
157157
"Enable left sidebar": z.boolean().default(false),
158158
"Suggestive mode enabled": z.boolean().default(false),
159159
"Reified relation triples": z.boolean().default(false),
160+
"Enable dual read": z.boolean().default(false),
160161
});
161162

162163
export const ExportSettingsSchema = z.object({

apps/roam/src/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ import {
4242
DISALLOW_DIAGNOSTICS,
4343
} from "./data/userSettings";
4444
import { initSchema } from "./components/settings/utils/init";
45+
import { setupPullWatchOnSettingsPage } from "./components/settings/utils/pullWatchers";
4546
export const DEFAULT_CANVAS_PAGE_FORMAT = "Canvas/*";
4647

4748
export default runExtension(async (onloadArgs) => {
@@ -154,7 +155,8 @@ export default runExtension(async (onloadArgs) => {
154155
});
155156
}
156157

157-
await initSchema();
158+
const { blockUids } = await initSchema();
159+
const cleanupPullWatchers = setupPullWatchOnSettingsPage(blockUids);
158160

159161
return {
160162
elements: [
@@ -166,6 +168,7 @@ export default runExtension(async (onloadArgs) => {
166168
],
167169
observers: observers,
168170
unload: () => {
171+
cleanupPullWatchers();
169172
setSyncActivity(false);
170173
window.roamjs.extension?.smartblocks?.unregisterCommand("QUERYBUILDER");
171174
// @ts-expect-error - tldraw throws a warning on multiple loads

0 commit comments

Comments
 (0)