Skip to content

Commit

Permalink
fix: single types selectable for related
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeVoyager committed Oct 12, 2024
1 parent 85d505b commit 9e99195
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
14 changes: 9 additions & 5 deletions admin/src/pages/SettingsPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ const Inner = () => {

const handleChange = (eventOrPath: FormChangeEvent, value?: any, nativeOnChange?: (eventOrPath: FormChangeEvent, value?: any) => void) => {
if (nativeOnChange) {

let fieldName = eventOrPath;
let fieldValue = value;

Expand All @@ -108,15 +107,20 @@ const Inner = () => {
setFormValueItem(fieldName, fieldValue);
}


return nativeOnChange(eventOrPath as FormChangeEvent, fieldValue);
}
};

const setFormValueItem = (path: string, value: any) => {
setFormValue(set({
...formValue,
}, path, value));
setFormValue((current) =>
set(
{
...current,
},
path,
value
)
);
};

const renderError = (error: string): string | undefined => {
Expand Down
8 changes: 3 additions & 5 deletions server/src/services/admin/admin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,7 @@ const adminService = (context: { strapi: Core.Strapi }) => ({

if (isSingleTypeWithPublishFlow) {
const itemsCountOrBypass = isSingleTypeWithPublishFlow
? await repository.count({
publishedAt: {
$notNull: true,
},
})
? await repository.count({}, 'published')
: true;

return returnType(itemsCountOrBypass !== 0);
Expand Down Expand Up @@ -550,6 +546,8 @@ const adminService = (context: { strapi: Core.Strapi }) => ({

validateAdditionalFields(newConfig.additionalFields);

console.log({ newConfig });

await pluginStore.set({ key: 'config', value: newConfig });

const removedFields = differenceBy(
Expand Down

0 comments on commit 9e99195

Please sign in to comment.