Skip to content

Commit

Permalink
chore(palette): use initial palette entries reference
Browse files Browse the repository at this point in the history
  • Loading branch information
Niklas Kiefer committed Oct 19, 2023
1 parent fea245f commit 3dc6e83
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ export default function Palette(props) {

const formFields = useService('formFields');

const initialPaletteEntries = collectPaletteEntries(formFields);
const initialPaletteEntries = useRef(collectPaletteEntries(formFields));

const [ paletteEntries, setPaletteEntries ] = useState(initialPaletteEntries);
const [ paletteEntries, setPaletteEntries ] = useState(initialPaletteEntries.current);

const [ searchTerm, setSearchTerm ] = useState('');

Expand Down Expand Up @@ -90,7 +90,7 @@ export default function Palette(props) {

// filter entries on search change
useEffect(() => {
const entries = initialPaletteEntries.filter(filter);
const entries = initialPaletteEntries.current.filter(filter);
setPaletteEntries(entries);
}, [ filter, searchTerm ]);

Expand Down Expand Up @@ -214,7 +214,7 @@ export function getPaletteIcon(entry) {
let Icon;

if (iconUrl) {
Icon = () => <img class="fjs-field-icon-image" width={ 36 } alt={ label } src={ sanitizeImageSource(iconUrl) } />;
Icon = () => <img class="fjs-field-icon-image" width={ 36 } style={ { margin: 'auto' } } alt={ label } src={ sanitizeImageSource(iconUrl) } />;
} else {
Icon = icon || iconsByType(type);
}
Expand Down

0 comments on commit 3dc6e83

Please sign in to comment.