fix: update layout options after fetching settings

This commit is contained in:
Aaryan Khandelwal 2024-06-04 21:07:49 +05:30
parent 761c65830c
commit 2921f230bf
2 changed files with 29 additions and 28 deletions

View File

@ -40,32 +40,31 @@ export const NavbarIssueBoardView: FC<NavbarIssueBoardViewProps> = observer((pro
return (
<>
{issueLayoutViews &&
Object.keys(issueLayoutViews).map((key: string) => {
const layoutKey = key as TIssueLayout;
if (layoutOptions[layoutKey]) {
return (
<div
key={layoutKey}
className={`flex h-[28px] w-[28px] cursor-pointer items-center justify-center rounded-sm ${
layoutKey === activeLayout
? `bg-custom-background-80 text-custom-text-200`
: `text-custom-text-300 hover:bg-custom-background-80`
{Object.keys(issueLayoutViews).map((key: string) => {
const layoutKey = key as TIssueLayout;
if (layoutOptions[layoutKey]) {
return (
<div
key={layoutKey}
className={`flex h-[28px] w-[28px] cursor-pointer items-center justify-center rounded-sm ${
layoutKey === activeLayout
? `bg-custom-background-80 text-custom-text-200`
: `text-custom-text-300 hover:bg-custom-background-80`
}`}
onClick={() => handleCurrentBoardView(layoutKey)}
title={layoutKey}
>
<span
className={`material-symbols-rounded text-[18px] ${
issueLayoutViews[layoutKey]?.className ? issueLayoutViews[layoutKey]?.className : ``
}`}
onClick={() => handleCurrentBoardView(layoutKey)}
title={layoutKey}
>
<span
className={`material-symbols-rounded text-[18px] ${
issueLayoutViews[layoutKey]?.className ? issueLayoutViews[layoutKey]?.className : ``
}`}
>
{issueLayoutViews[layoutKey]?.icon}
</span>
</div>
);
}
})}
{issueLayoutViews[layoutKey]?.icon}
</span>
</div>
);
}
})}
</>
);
});

View File

@ -38,13 +38,15 @@ export class PublishListStore implements IPublishListStore {
*/
fetchPublishSettings = async (anchor: string) => {
try {
const publishSettings = await this.publishService.fetchPublishSettings(anchor);
const response = await this.publishService.fetchPublishSettings(anchor);
runInAction(() => {
if (publishSettings.anchor)
set(this.publishMap, [publishSettings.anchor], new PublishStore(this.store, publishSettings));
if (response.anchor && response.view_props) {
this.store.issueFilter.updateLayoutOptions(response?.view_props);
set(this.publishMap, [response.anchor], new PublishStore(this.store, response));
}
});
return publishSettings;
return response;
} catch (error) {
throw error;
}