Skip to content

Commit 31aa0ff

Browse files
committed
address: todo for trackError.
1 parent 466cc8d commit 31aa0ff

File tree

2 files changed

+10
-8
lines changed
  • src

2 files changed

+10
-8
lines changed

src/lib/actions/analytics.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export function trackEvent(name: string, data: object = null): void {
7676
}
7777

7878
export function trackError(exception: Error, event: Submit): void {
79-
if (exception instanceof AppwriteException && exception.type) {
79+
if (exception instanceof AppwriteException && exception.type && event) {
8080
trackEvent(Submit.Error, {
8181
type: exception.type,
8282
form: event

src/routes/(console)/project-[region]-[project]/databases/database-[database]/(entity)/views/create.svelte

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script lang="ts">
22
import { page } from '$app/state';
3-
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
3+
import { trackEvent, trackError } from '$lib/actions/analytics';
44
import { Modal, CustomId } from '$lib/components';
55
import { subNavigation } from '$lib/stores/database';
66
import { ID } from '@appwrite.io/console';
@@ -11,7 +11,7 @@
1111
tableColumnSuggestions
1212
} from '$database/(suggestions)/index';
1313
14-
import { useTerminology } from '../helpers';
14+
import { getTerminologies } from '../helpers';
1515
1616
let {
1717
show = $bindable(false),
@@ -23,9 +23,11 @@
2323
onCreateEntity: (id: string, name: string) => Promise<void>;
2424
} = $props();
2525
26-
const entity = $derived(useTerminology(page).entity);
27-
const lower = $derived(entity.lower.singular);
28-
const title = $derived(entity.title.singular);
26+
const { analytics, terminology } = getTerminologies();
27+
28+
const lower = terminology.entity.lower.singular;
29+
const title = terminology.entity.title.singular;
30+
const analyticsCreateSubmit = analytics.submit.entity('Create');
2931
3032
// example - `table-[table]`, `collection-[collection]`
3133
const isOnEntitiesPage = $derived(page.route?.id.endsWith(`${lower}-[${lower}]`));
@@ -65,7 +67,7 @@
6567
updateAndCleanup();
6668
} catch (e) {
6769
error = e.message;
68-
trackError(e, Submit.TableCreate);
70+
trackError(e, analyticsCreateSubmit);
6971
}
7072
}
7173
@@ -77,7 +79,7 @@
7779
message: `${name} has been created`
7880
});
7981
80-
trackEvent(Submit.TableCreate, { customId: !!id });
82+
trackEvent(analyticsCreateSubmit, { customId: !!id });
8183
8284
// reset vars!
8385
name = id = null;

0 commit comments

Comments
 (0)