Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions docs/reference/alpha-web-ui.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,18 @@ Options:

This will spin up a Web UI on localhost which automatically refreshes its view of the registry every `registry_ttl_sec`

#### Curl Generator Feature Server URL

The Curl Generator uses a default Feature Server URL when building the example curl command. You can configure
this default at build time using:

```bash
REACT_APP_FEAST_FEATURE_SERVER_URL="http://your-server:6566"
```

If this environment variable is not set, the UI falls back to `http://localhost:6566`. A user-edited value in
the UI is still stored in localStorage and will take precedence for that browser.

### Importing as a module to integrate with an existing React App

This is the recommended way to use Feast UI for teams maintaining their own internal UI for their deployment of Feast.
Expand Down
7 changes: 5 additions & 2 deletions ui/src/pages/feature-views/CurlGeneratorTab.tsx
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 useEffect unconditionally persists default URL to localStorage, preventing env var updates from taking effect for returning users

The useEffect on line 35-37 saves serverUrl to localStorage on every change, including the initial render. When a user first visits the page, the defaultServerUrl (from the env var) is immediately persisted to localStorage. If an admin later changes REACT_APP_FEAST_FEATURE_SERVER_URL and rebuilds the app, returning users will still see the old URL because localStorage (containing the old default) takes precedence over the new env var value in the useState initializer at line 26-28. This undermines the stated purpose of this PR — making the default URL configurable — since the configuration change only affects brand-new users who have never visited the page.

A fix would be to only write to localStorage when the user explicitly edits the URL (e.g., in the onChange handler), or to store a flag distinguishing user-edited values from auto-persisted defaults.

(Refers to lines 35-37)

Prompt for agents
In ui/src/pages/feature-views/CurlGeneratorTab.tsx, the useEffect at lines 35-37 unconditionally persists serverUrl to localStorage on every change including the initial default value. This means if the admin changes REACT_APP_FEAST_FEATURE_SERVER_URL and rebuilds, returning users will still see the old default.

To fix this, persist the URL to localStorage only when the user explicitly edits it. One approach:

1. Remove the useEffect that auto-saves serverUrl to localStorage (lines 35-37).
2. In the onChange handler for the EuiFieldText (around line 112), save to localStorage there:
   onChange={(e) => {
     setServerUrl(e.target.value);
     localStorage.setItem("feast-feature-server-url", e.target.value);
   }}

This way, localStorage only contains a value if the user explicitly typed one, and the env var default will always be respected for users who haven't customized the URL.
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kchawlani19 this needs to be handled, move localStorage.setItem into the onChange handler and drop the useEffect

Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,16 @@ import {
import { CodeBlock, github } from "react-code-blocks";
import { RegularFeatureViewCustomTabProps } from "../../custom-tabs/types";

const defaultServerUrl =
process.env.REACT_APP_FEAST_FEATURE_SERVER_URL || "http://localhost:6566";

const CurlGeneratorTab = ({
feastObjectQuery,
}: RegularFeatureViewCustomTabProps) => {
const data = feastObjectQuery.data as any;
const [serverUrl, setServerUrl] = useState(() => {
const savedUrl = localStorage.getItem("feast-feature-server-url");
return savedUrl || "http://localhost:6566";
return savedUrl || defaultServerUrl;
});
const [entityValues, setEntityValues] = useState<Record<string, string>>({});
const [selectedFeatures, setSelectedFeatures] = useState<
Expand Down Expand Up @@ -107,7 +110,7 @@ const CurlGeneratorTab = ({
<EuiFieldText
value={serverUrl}
onChange={(e) => setServerUrl(e.target.value)}
placeholder="http://localhost:6566"
placeholder={defaultServerUrl}
/>
</EuiFormRow>

Expand Down
Loading