Skip to content

Commit

Permalink
fix: infinite loop in parseUserConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
mscolnick committed Mar 19, 2024
1 parent 5e67e99 commit 8667c05
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions frontend/src/core/config/config-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,16 @@ export function parseAppConfig() {
}

export function parseUserConfig(): UserConfig {
try {
// For Pyodide, we use the local storage to store the user config.
if (isPyodide()) {
return UserConfigLocalStorage.get();
}
// For Pyodide, we use the local storage to store the user config.
if (isPyodide()) {
return UserConfigLocalStorage.get();
}

return parseUserConfigDOM();
}

function parseUserConfigDOM(): UserConfig {
try {
const parsed = UserConfigSchema.parse(JSON.parse(getRawMarimoUserConfig()));
for (const [key, value] of Object.entries(parsed.experimental)) {
if (value === true) {
Expand All @@ -123,7 +127,7 @@ export function parseUserConfig(): UserConfig {
export const UserConfigLocalStorage = new ZodLocalStorage<UserConfig>(
"marimo:user-config",
UserConfigSchema,
() => parseUserConfig(),
() => parseUserConfigDOM(),
);

function setFeatureFlag(
Expand Down

0 comments on commit 8667c05

Please sign in to comment.