Skip to content

Commit

Permalink
Fixes tags not showing until page reload (#456)
Browse files Browse the repository at this point in the history
  • Loading branch information
pushchris authored Apr 17, 2024
1 parent 0d44b61 commit e50f572
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
4 changes: 3 additions & 1 deletion apps/platform/src/journey/JourneyRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export const getJourney = async (id: number, projectId: number): Promise<Journey
}

export const updateJourney = async (id: number, { tags, ...params }: UpdateJourneyParams, db = App.main.db): Promise<Journey> => {
return db.transaction(async trx => {
const journey = await db.transaction(async trx => {
const journey = await Journey.updateAndFetch(id, params, trx)
if (tags) {
await setTags({
Expand All @@ -73,6 +73,8 @@ export const updateJourney = async (id: number, { tags, ...params }: UpdateJourn
}
return journey
})

return await getJourney(id, journey.project_id)
}

export const deleteJourney = async (id: number, projectId: number): Promise<void> => {
Expand Down
2 changes: 1 addition & 1 deletion apps/platform/src/lists/ListService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export const updateList = async (list: List, { tags, rule, published, ...params
await ListPopulateJob.from(list.id, list.project_id).queue()
}

return list
return await getList(list.id, list.project_id)
}

export const archiveList = async (id: number, projectId: number) => {
Expand Down
8 changes: 4 additions & 4 deletions apps/ui/src/views/users/ListDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ export default function ListDetail() {
const state = useSearchTableState(useCallback(async params => await api.lists.users(project.id, list.id, params), [list, project]))
const route = useRoute()

const saveList = async ({ name, rule, published }: ListUpdateParams) => {
const value = await api.lists.update(project.id, list.id, { name, rule, published })
const saveList = async ({ name, rule, published, tags }: ListUpdateParams) => {
const value = await api.lists.update(project.id, list.id, { name, rule, published, tags })
setIsEditListOpen(false)
setIsDialogOpen(true)
setList(value)
Expand Down Expand Up @@ -110,9 +110,9 @@ export default function ListDetail() {
onClose={() => setIsEditListOpen(false)}
title={t('edit_list')}>
<FormWrapper<Omit<ListUpdateParams, 'rule'>>
onSubmit={async ({ name, published }) => await saveList({ name, published })}
onSubmit={async ({ name, published, tags }) => await saveList({ name, published, tags })}
submitLabel={t('save')}
defaultValues={{ name: list.name }}
defaultValues={{ name: list.name, tags: list.tags }}
>
{form => (
<>
Expand Down

0 comments on commit e50f572

Please sign in to comment.