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 ( return (
<> <>
{issueLayoutViews && {Object.keys(issueLayoutViews).map((key: string) => {
Object.keys(issueLayoutViews).map((key: string) => { const layoutKey = key as TIssueLayout;
const layoutKey = key as TIssueLayout; if (layoutOptions[layoutKey]) {
if (layoutOptions[layoutKey]) { return (
return ( <div
<div key={layoutKey}
key={layoutKey} className={`flex h-[28px] w-[28px] cursor-pointer items-center justify-center rounded-sm ${
className={`flex h-[28px] w-[28px] cursor-pointer items-center justify-center rounded-sm ${ layoutKey === activeLayout
layoutKey === activeLayout ? `bg-custom-background-80 text-custom-text-200`
? `bg-custom-background-80 text-custom-text-200` : `text-custom-text-300 hover:bg-custom-background-80`
: `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 {issueLayoutViews[layoutKey]?.icon}
className={`material-symbols-rounded text-[18px] ${ </span>
issueLayoutViews[layoutKey]?.className ? issueLayoutViews[layoutKey]?.className : `` </div>
}`} );
> }
{issueLayoutViews[layoutKey]?.icon} })}
</span>
</div>
);
}
})}
</> </>
); );
}); });

View File

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