Skip to content

Commit

Permalink
fix: unrelated minor comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Kiryous committed Nov 19, 2024
1 parent 2cbe6b8 commit 34cc798
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 11 deletions.
1 change: 0 additions & 1 deletion keep-ui/app/dashboard/[id]/dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ const DashboardPage = () => {

const handleEditWidget = (id: string, update?: WidgetData) => {
let itemToEdit = widgetData.find((d) => d.i === id) || null;
console.log(itemToEdit, update);
if (itemToEdit && update) {
setEditingItem({ ...itemToEdit, ...update });
} else {
Expand Down
26 changes: 18 additions & 8 deletions keep-ui/utils/hooks/useDashboardPresets.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useHydratedSession as useSession } from "@/shared/lib/hooks/useHydratedSession";
import { usePresets } from "./usePresets";
import { Preset } from "app/alerts/models";
import { useMemo } from "react";
import { useCallback, useMemo } from "react";
import { useSearchParams } from "next/navigation";

export const useDashboardPreset = () => {
Expand All @@ -22,12 +22,15 @@ export const useDashboardPreset = () => {
});
const searchParams = useSearchParams();

const checkValidPreset = (preset: Preset) => {
if (!preset.is_private) {
return true;
}
return preset && preset.created_by == session?.user?.email;
};
const checkValidPreset = useCallback(
(preset: Preset) => {
if (!preset.is_private) {
return true;
}
return preset && preset.created_by == session?.user?.email;
},
[session]
);

let allPreset = useMemo(() => {
/*If any filters are applied on the dashboard, we will fetch live data; otherwise,
Expand All @@ -40,7 +43,14 @@ export const useDashboardPreset = () => {
checkValidPreset(preset)
);
return combinedPresets;
}, [presets, fetchedPresets, searchParams, presets, fetchedPresets]);
}, [
searchParams,
presets,
fetchedPresets,
presetsOrderFromLS,
staticPresetsOrderFromLS,
checkValidPreset,
]);

return allPreset;
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"""

from datetime import datetime
import sqlalchemy as sa
from alembic import op

Expand All @@ -23,8 +24,7 @@ def upgrade() -> None:
sa.Column(
"timestamp",
sa.DateTime(),
nullable=False,
server_default=sa.text("CURRENT_TIMESTAMP"),
nullable=True,
),
)
op.add_column(
Expand Down

0 comments on commit 34cc798

Please sign in to comment.