Skip to content

Commit

Permalink
removed lodash
Browse files Browse the repository at this point in the history
  • Loading branch information
fomalhautb committed Jan 7, 2025
1 parent 02fa7f7 commit b85b91f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import { EMAIL_TEMPLATES_METADATA, convertEmailSubjectVariables, convertEmailTem
import { EmailTemplateType } from "@stackframe/stack-shared/dist/interface/crud/email-templates";
import { strictEmailSchema } from "@stackframe/stack-shared/dist/schema-fields";
import { throwErr } from "@stackframe/stack-shared/dist/utils/errors";
import { deepPlainEquals } from "@stackframe/stack-shared/dist/utils/objects";
import { ActionCell, ActionDialog, Alert, Button, Card, SimpleTooltip, Typography, useToast } from "@stackframe/stack-ui";
import _ from "lodash";
import { useMemo, useState } from "react";
import * as yup from "yup";
import { PageLayout } from "../page-layout";
Expand Down Expand Up @@ -234,7 +234,7 @@ function EditEmailServerDialog(props: {
cancelButton
onFormChange={(form) => {
const values = form.getValues();
if (!_.isEqual(values, formValues)) {
if (!deepPlainEquals(values, formValues)) {
setFormValues(values);
setError(null);
}
Expand Down
2 changes: 0 additions & 2 deletions packages/stack-emails/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,11 @@
"zustand": "^4.5.2",
"zod": "^3.23.8",
"handlebars": "^4.7.8",
"lodash": "^4.17.21",
"@stackframe/stack-shared": "workspace:*",
"@stackframe/stack-ui": "workspace:*"
},
"devDependencies": {
"rimraf": "^5.0.5",
"@types/lodash": "^4.17.5",
"react": "^18.2",
"react-dom": "^18.2",
"next": "^14.1.0"
Expand Down
8 changes: 4 additions & 4 deletions packages/stack-emails/src/editor/editor.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { deepPlainEquals } from '@stackframe/stack-shared/dist/utils/objects';
import { useEffect, useMemo } from 'react';
import { EmailTemplateMetadata, convertEmailTemplateMetadataExampleValues } from '../utils';
import { TEditorConfiguration } from './documents/editor/core';
import { resetDocument, setDocument, setMetadata, setSubject, useDocument, useSubject } from './documents/editor/editor-context';
import InspectorDrawer from './sidebar';
import TemplatePanel from './template-panel';
import { TEditorConfiguration } from './documents/editor/core';
import _ from 'lodash';
import { EmailTemplateMetadata, convertEmailTemplateMetadataExampleValues } from '../utils';

export default function EmailEditor(props: {
document: TEditorConfiguration,
Expand Down Expand Up @@ -33,7 +33,7 @@ export default function EmailEditor(props: {
}, [props.resetSignal]);

const edited = useMemo(() => {
return !_.isEqual(props.document, document) || props.subject !== subject;
return !deepPlainEquals(props.document, document) || props.subject !== subject;
}, [props.document, document, props.subject, subject]);

useEffect(() => {
Expand Down

0 comments on commit b85b91f

Please sign in to comment.