Skip to content

Commit

Permalink
bugfix: dataset tracking id not resetting
Browse files Browse the repository at this point in the history
  • Loading branch information
skeptrunedev authored and fedhacks committed Dec 16, 2024
1 parent e3b9d8c commit 147ca29
Showing 1 changed file with 3 additions and 11 deletions.
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

0 comments on commit 147ca29

Please sign in to comment.