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

bugfix: dataset tracking id not resetting #2956

Merged
merged 1 commit into from
Dec 16, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,11 @@ export const TrackingIdUpdater = () => {
},
}));

const [input, setInput] = createSignal(
"", // Replaced by context as soon as the memo syncs
);
const [hasEdited, setHasEdited] = createSignal(false);
const [input, setInput] = createSignal("");

createEffect(() => {
// If the tracking id is the same as the current tracking id, then don't show the input
const orgTrackingId = datasetContext.dataset()?.dataset.tracking_id;
if (input() === "" && orgTrackingId && !hasEdited()) {
setInput(orgTrackingId);
}
const datasetTracking = datasetContext.dataset()?.dataset.tracking_id;
setInput(datasetTracking || "");
});

const handleSave = () => {
Expand All @@ -68,10 +62,8 @@ export const TrackingIdUpdater = () => {
placeholder="Enter Tracking ID..."
class="rounded-md border px-2 py-1 text-sm"
value={input() || ""}
onFocus={() => setHasEdited(true)}
onInput={(e) => {
setInput(e.currentTarget.value);
setHasEdited(true);
}}
/>
<Show
Expand Down