Skip to content

Commit

Permalink
Merge pull request #2994 from uktrade/fix/DT-1824-guard-against-remov…
Browse files Browse the repository at this point in the history
…ed-datasets

fix/DT-1824 Guard against null being returned
  • Loading branch information
ian-leggett authored Feb 2, 2024
2 parents dd7f2c0 + 120ff44 commit 3cd55fb
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
11 changes: 11 additions & 0 deletions dataworkspace/dataworkspace/static/js/react/services/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,17 @@ export const recentItems = {
next: null,
previous: null,
results: [
{
id: 9,
timestamp: '2023-12-01T12:21:36.555002Z',
event_type: 'Dataset view',
user_id: 1,
related_object: null,
extra: {
path: '/datasets/001122',
reference_dataset_version: '2023-12-01'
}
},
{
id: 8,
timestamp: '2023-12-01T12:21:36.555002Z',
Expand Down
10 changes: 6 additions & 4 deletions dataworkspace/dataworkspace/static/js/react/transformers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,12 @@ export const transformRecentCollectionsResponse = (
export const transformRecentItemsResponse = (
response: YourRecentIemsResponse
): TransformedYourRecentItemsResponse =>
response.results.map(({ related_object, extra }) => ({
name: related_object.name,
url: extra.path
}));
response.results
.filter((result) => result.related_object)
.map(({ related_object, extra }) => ({
name: related_object.name,
url: extra.path
}));

export const transformYourBookmarksResponse = (
response: YourBookmarksResponse
Expand Down

0 comments on commit 3cd55fb

Please sign in to comment.