Skip to content

Commit c32b18a

Browse files
fix: inconsistencies between dark and light theme override (#487)
* fix: inconsistencies between dark and light theme override * fix(hydra): add array check for @id * test: fix tests after 4.4.2 * chore: update CHANGELOG Co-authored-by: Alan Poulain <contact@alanpoulain.eu>
1 parent 8d7060e commit c32b18a

File tree

4 files changed

+11
-3
lines changed

4 files changed

+11
-3
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 3.4.3
4+
5+
* Fix inconsistencies between dark and light theme
6+
37
## 3.4.2
48

59
* Format identifier values on save (needed when not modified in the form)

src/InputGuesser.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,8 @@ describe('<InputGuesser />', () => {
170170
await waitFor(() => {
171171
expect(updatedData).toMatchObject({
172172
title: 'Title Foo',
173-
description: '',
174-
nullText: '',
173+
description: null,
174+
nullText: null,
175175
});
176176
});
177177
});

src/hydra/dataProvider.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ class ReactAdminDocument implements ApiPlatformAdminRecord {
5757
if (!obj['@id']) {
5858
throw new Error('Document needs to have an @id member.');
5959
}
60+
if (Array.isArray(obj['@id'])) {
61+
throw new Error('Document needs to have a string @id member.');
62+
}
6063
this.id = obj['@id'];
6164
}
6265

@@ -117,7 +120,7 @@ export const transformJsonLdDocumentToReactAdminDocument = (
117120
document[key][0]['@id']
118121
) {
119122
document[key] = document[key].map((obj: JsonLdObj) => {
120-
if (addToCache && obj['@id']) {
123+
if (addToCache && obj['@id'] && !Array.isArray(obj['@id'])) {
121124
reactAdminDocumentsCache.set(
122125
obj['@id'],
123126
transformJsonLdDocumentToReactAdminDocument(obj, false, false),

src/layout/themes.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ export const lightTheme: RaThemeOptions = {
5454
mode: 'light',
5555
},
5656
components: {
57+
...defaultTheme.components,
5758
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
5859
// @ts-ignore react-admin doesn't add its own components
5960
RaMenuItemLink: {

0 commit comments

Comments
 (0)