fix: ID not being reset when creating new feeds, causing unintentional edits over existing feeds
All checks were successful
Build / build (push) Successful in 39s

This commit is contained in:
Corban-Lee Jones 2025-05-02 13:43:59 +01:00
parent 73aed35ce0
commit a0d2711a51

View File

@ -1,11 +1,10 @@
import $ from "jquery"; import $ from "jquery";
import "datatables.net-select-dt"; import "datatables.net-select-dt";
import DataTable, { Api } from "datatables.net-dt"
import HSDropdown from "@preline/dropdown"; import HSDropdown from "@preline/dropdown";
import HSOverlay, { IOverlayOptions } from "@preline/overlay"; import HSOverlay, { IOverlayOptions } from "@preline/overlay";
import HSSelect, { ISelectOptions } from "@preline/select"; import HSSelect, { ISelectOptions } from "@preline/select";
import HSDataTable, { IDataTableOptions } from "@preline/datatable"; import HSDataTable, { IDataTableOptions } from "@preline/datatable";
import { ConfigColumnDefs, AjaxSettings } from "datatables.net-dt"; import DataTable, { Api, ConfigColumnDefs, AjaxSettings } from "datatables.net-dt";
import { autoUpdate, computePosition, offset } from "@floating-ui/dom"; import { autoUpdate, computePosition, offset } from "@floating-ui/dom";
import { formatTimestamp, verifyChannels } from "../../../src/ts/main"; import { formatTimestamp, verifyChannels } from "../../../src/ts/main";
import prisma from "../../../../../generated/prisma"; import prisma from "../../../../../generated/prisma";
@ -314,7 +313,7 @@ const pageSelectOptions: ISelectOptions = {
</div>`, </div>`,
toggleClasses: "cj-table-paging-select-toggle", toggleClasses: "cj-table-paging-select-toggle",
optionClasses: "cj-table-paging-select-option", optionClasses: "cj-table-paging-select-option",
dropdownClasses: `cj-table-paging-select-dropdown`, dropdownClasses: "cj-table-paging-select-dropdown",
dropdownSpace: 10, dropdownSpace: 10,
dropdownScope: "parent", dropdownScope: "parent",
dropdownPlacement: "top", dropdownPlacement: "top",
@ -348,7 +347,7 @@ interface FeedWithChannels extends prisma.Feed {
} }
const clearEditModalData = () => { const clearEditModalData = () => {
$(editModal.el).data("id", undefined); $(editModal.el).removeData("id");
$("#formName").val(""); $("#formName").val("");
$("#formUrl").val(""); $("#formUrl").val("");
@ -377,6 +376,7 @@ const openEditModal = async (id: number | undefined) => {
// when determining the width of the input placeholder 'Select option...'. This // when determining the width of the input placeholder 'Select option...'. This
// requires the modal to be opened before running the calculation, which could be // requires the modal to be opened before running the calculation, which could be
// bad. // bad.
$("#editForm").removeClass("submitted");
editModal.open(); editModal.open();
id === undefined id === undefined