[WEB-6986] fix: resolve ref forwarding warning in Recents widget and MobX strict-mode violation in IssueRootStore (#6786)
This commit is contained in:
@@ -72,11 +72,11 @@ export const RecentActivityWidget = observer(function RecentActivityWidget(props
|
||||
switch (activity.entity_name) {
|
||||
case "page":
|
||||
case "workspace_page":
|
||||
return <RecentPage activity={activity} ref={ref} workspaceSlug={workspaceSlug} />;
|
||||
return <RecentPage activity={activity} parentRef={ref} workspaceSlug={workspaceSlug} />;
|
||||
case "project":
|
||||
return <RecentProject activity={activity} ref={ref} workspaceSlug={workspaceSlug} />;
|
||||
return <RecentProject activity={activity} parentRef={ref} workspaceSlug={workspaceSlug} />;
|
||||
case "issue":
|
||||
return <RecentIssue activity={activity} ref={ref} workspaceSlug={workspaceSlug} />;
|
||||
return <RecentIssue activity={activity} parentRef={ref} workspaceSlug={workspaceSlug} />;
|
||||
default:
|
||||
return <></>;
|
||||
}
|
||||
|
||||
@@ -32,11 +32,11 @@ import { IssueIdentifier } from "@/components/issues/issue-detail/issue-identifi
|
||||
|
||||
type BlockProps = {
|
||||
activity: TActivityEntityData;
|
||||
ref: React.RefObject<HTMLDivElement>;
|
||||
parentRef: React.RefObject<HTMLDivElement>;
|
||||
workspaceSlug: string;
|
||||
};
|
||||
export const RecentIssue = observer(function RecentIssue(props: BlockProps) {
|
||||
const { activity, ref, workspaceSlug } = props;
|
||||
const { activity, parentRef, workspaceSlug } = props;
|
||||
// hooks
|
||||
const { getStateById } = useProjectState();
|
||||
const { setPeekIssue } = useIssueDetail();
|
||||
@@ -144,7 +144,7 @@ export const RecentIssue = observer(function RecentIssue(props: BlockProps) {
|
||||
)}
|
||||
</div>
|
||||
}
|
||||
parentRef={ref}
|
||||
parentRef={parentRef}
|
||||
disableLink={false}
|
||||
className="my-auto !px-2 border-none py-3"
|
||||
itemClassName="my-auto"
|
||||
|
||||
@@ -24,12 +24,12 @@ import { useMember } from "@/hooks/store/use-member";
|
||||
|
||||
type BlockProps = {
|
||||
activity: TActivityEntityData;
|
||||
ref: React.RefObject<HTMLDivElement>;
|
||||
parentRef: React.RefObject<HTMLDivElement>;
|
||||
workspaceSlug: string;
|
||||
};
|
||||
|
||||
export function RecentPage(props: BlockProps) {
|
||||
const { activity, ref, workspaceSlug } = props;
|
||||
const { activity, parentRef, workspaceSlug } = props;
|
||||
// router
|
||||
const router = useRouter();
|
||||
// store hooks
|
||||
@@ -75,7 +75,7 @@ export function RecentPage(props: BlockProps) {
|
||||
<Avatar src={getFileURL(ownerDetails?.avatar_url ?? "")} name={ownerDetails?.display_name} />
|
||||
</div>
|
||||
}
|
||||
parentRef={ref}
|
||||
parentRef={parentRef}
|
||||
disableLink={false}
|
||||
className="my-auto !px-2 border-none py-3"
|
||||
itemClassName="my-auto bg-layer-transparent"
|
||||
|
||||
@@ -23,11 +23,11 @@ import { MemberDropdown } from "@/components/dropdowns/member/dropdown";
|
||||
|
||||
type BlockProps = {
|
||||
activity: TActivityEntityData;
|
||||
ref: React.RefObject<HTMLDivElement>;
|
||||
parentRef: React.RefObject<HTMLDivElement>;
|
||||
workspaceSlug: string;
|
||||
};
|
||||
export function RecentProject(props: BlockProps) {
|
||||
const { activity, ref, workspaceSlug } = props;
|
||||
const { activity, parentRef, workspaceSlug } = props;
|
||||
// router
|
||||
const router = useRouter();
|
||||
// derived values
|
||||
@@ -80,7 +80,7 @@ export function RecentProject(props: BlockProps) {
|
||||
)}
|
||||
</div>
|
||||
}
|
||||
parentRef={ref}
|
||||
parentRef={parentRef}
|
||||
disableLink={false}
|
||||
className="my-auto !px-2 border-none py-3"
|
||||
itemClassName="my-auto"
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
*/
|
||||
|
||||
import { isEmpty } from "lodash-es";
|
||||
import { autorun, makeObservable, observable } from "mobx";
|
||||
import { autorun, makeObservable, observable, runInAction } from "mobx";
|
||||
// types
|
||||
import type { ICycle, IIssueLabel, IModule, IProject, IState, IUserLite, TIssueServiceType } from "@plane/types";
|
||||
import { EIssueServiceType } from "@plane/types";
|
||||
@@ -237,27 +237,29 @@ export class IssueRootStore implements IIssueRootStore {
|
||||
this.rootStore = rootStore;
|
||||
|
||||
autorun(() => {
|
||||
if (rootStore?.user?.data?.id) this.currentUserId = rootStore?.user?.data?.id;
|
||||
if (this.workspaceSlug !== rootStore.router.workspaceSlug) this.workspaceSlug = rootStore.router.workspaceSlug;
|
||||
if (this.teamspaceId !== rootStore.router.teamspaceId) this.teamspaceId = rootStore.router.teamspaceId;
|
||||
if (this.projectId !== rootStore.router.projectId) this.projectId = rootStore.router.projectId;
|
||||
if (this.cycleId !== rootStore.router.cycleId) this.cycleId = rootStore.router.cycleId;
|
||||
if (this.moduleId !== rootStore.router.moduleId) this.moduleId = rootStore.router.moduleId;
|
||||
if (this.releaseId !== rootStore.router.releaseId) this.releaseId = rootStore.router.releaseId;
|
||||
if (this.viewId !== rootStore.router.viewId) this.viewId = rootStore.router.viewId;
|
||||
if (this.globalViewId !== rootStore.router.globalViewId) this.globalViewId = rootStore.router.globalViewId;
|
||||
if (this.userId !== rootStore.router.userId) this.userId = rootStore.router.userId;
|
||||
if (!isEmpty(rootStore?.state?.stateMap)) this.stateMap = rootStore?.state?.stateMap;
|
||||
if (!isEmpty(rootStore?.state?.projectStates)) this.stateDetails = rootStore?.state?.projectStates;
|
||||
if (!isEmpty(rootStore?.state?.workspaceStates)) this.workspaceStateDetails = rootStore?.state?.workspaceStates;
|
||||
if (!isEmpty(rootStore?.label?.labelMap)) this.labelMap = rootStore?.label?.labelMap;
|
||||
if (!isEmpty(rootStore?.memberRoot?.workspace?.workspaceMemberMap))
|
||||
this.workSpaceMemberRolesMap = rootStore?.memberRoot?.workspace?.memberMap || undefined;
|
||||
if (!isEmpty(rootStore?.memberRoot?.memberMap)) this.memberMap = rootStore?.memberRoot?.memberMap || undefined;
|
||||
if (!isEmpty(rootStore?.projectRoot?.project?.projectMap))
|
||||
this.projectMap = rootStore?.projectRoot?.project?.projectMap;
|
||||
if (!isEmpty(rootStore?.module?.moduleMap)) this.moduleMap = rootStore?.module?.moduleMap;
|
||||
if (!isEmpty(rootStore?.cycle?.cycleMap)) this.cycleMap = rootStore?.cycle?.cycleMap;
|
||||
runInAction(() => {
|
||||
if (rootStore?.user?.data?.id) this.currentUserId = rootStore?.user?.data?.id;
|
||||
if (this.workspaceSlug !== rootStore.router.workspaceSlug) this.workspaceSlug = rootStore.router.workspaceSlug;
|
||||
if (this.teamspaceId !== rootStore.router.teamspaceId) this.teamspaceId = rootStore.router.teamspaceId;
|
||||
if (this.projectId !== rootStore.router.projectId) this.projectId = rootStore.router.projectId;
|
||||
if (this.cycleId !== rootStore.router.cycleId) this.cycleId = rootStore.router.cycleId;
|
||||
if (this.moduleId !== rootStore.router.moduleId) this.moduleId = rootStore.router.moduleId;
|
||||
if (this.releaseId !== rootStore.router.releaseId) this.releaseId = rootStore.router.releaseId;
|
||||
if (this.viewId !== rootStore.router.viewId) this.viewId = rootStore.router.viewId;
|
||||
if (this.globalViewId !== rootStore.router.globalViewId) this.globalViewId = rootStore.router.globalViewId;
|
||||
if (this.userId !== rootStore.router.userId) this.userId = rootStore.router.userId;
|
||||
if (!isEmpty(rootStore?.state?.stateMap)) this.stateMap = rootStore?.state?.stateMap;
|
||||
if (!isEmpty(rootStore?.state?.projectStates)) this.stateDetails = rootStore?.state?.projectStates;
|
||||
if (!isEmpty(rootStore?.state?.workspaceStates)) this.workspaceStateDetails = rootStore?.state?.workspaceStates;
|
||||
if (!isEmpty(rootStore?.label?.labelMap)) this.labelMap = rootStore?.label?.labelMap;
|
||||
if (!isEmpty(rootStore?.memberRoot?.workspace?.workspaceMemberMap))
|
||||
this.workSpaceMemberRolesMap = rootStore?.memberRoot?.workspace?.memberMap || undefined;
|
||||
if (!isEmpty(rootStore?.memberRoot?.memberMap)) this.memberMap = rootStore?.memberRoot?.memberMap || undefined;
|
||||
if (!isEmpty(rootStore?.projectRoot?.project?.projectMap))
|
||||
this.projectMap = rootStore?.projectRoot?.project?.projectMap;
|
||||
if (!isEmpty(rootStore?.module?.moduleMap)) this.moduleMap = rootStore?.module?.moduleMap;
|
||||
if (!isEmpty(rootStore?.cycle?.cycleMap)) this.cycleMap = rootStore?.cycle?.cycleMap;
|
||||
});
|
||||
});
|
||||
|
||||
this.issues = new IssueStore();
|
||||
|
||||
Reference in New Issue
Block a user