[WEB-5510] fix: handle null values in context indicator for improved stability (#8190)
This commit is contained in:
parent
39749106a2
commit
3c84e75350
2 changed files with 4 additions and 5 deletions
|
|
@ -1,8 +1,8 @@
|
||||||
// local imports
|
// local imports
|
||||||
import type { TPowerKContextTypeExtended } from "../types";
|
import type { TPowerKContextType } from "@/components/power-k/core/types";
|
||||||
|
|
||||||
type TArgs = {
|
type TArgs = {
|
||||||
activeContext: TPowerKContextTypeExtended | null;
|
activeContext: TPowerKContextType | null;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const useExtendedContextIndicator = (_args: TArgs): string | null => null;
|
export const useExtendedContextIndicator = (_args: TArgs): string | null => null;
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@ import { useCycle } from "@/hooks/store/use-cycle";
|
||||||
import { useModule } from "@/hooks/store/use-module";
|
import { useModule } from "@/hooks/store/use-module";
|
||||||
// plane web imports
|
// plane web imports
|
||||||
import { useExtendedContextIndicator } from "@/plane-web/components/command-palette/power-k/hooks/use-extended-context-indicator";
|
import { useExtendedContextIndicator } from "@/plane-web/components/command-palette/power-k/hooks/use-extended-context-indicator";
|
||||||
import type { TPowerKContextTypeExtended } from "@/plane-web/components/command-palette/power-k/types";
|
|
||||||
import { EPageStoreType, usePageStore } from "@/plane-web/hooks/store";
|
import { EPageStoreType, usePageStore } from "@/plane-web/hooks/store";
|
||||||
// local imports
|
// local imports
|
||||||
import type { TPowerKContextType } from "../core/types";
|
import type { TPowerKContextType } from "../core/types";
|
||||||
|
|
@ -25,13 +24,13 @@ export const useContextIndicator = (args: TArgs): string | null => {
|
||||||
const { getPageById } = usePageStore(EPageStoreType.PROJECT);
|
const { getPageById } = usePageStore(EPageStoreType.PROJECT);
|
||||||
// extended context indicator
|
// extended context indicator
|
||||||
const extendedIndicator = useExtendedContextIndicator({
|
const extendedIndicator = useExtendedContextIndicator({
|
||||||
activeContext: activeContext as TPowerKContextTypeExtended,
|
activeContext,
|
||||||
});
|
});
|
||||||
let indicator: string | undefined | null = null;
|
let indicator: string | undefined | null = null;
|
||||||
|
|
||||||
switch (activeContext) {
|
switch (activeContext) {
|
||||||
case "work-item": {
|
case "work-item": {
|
||||||
indicator = workItemIdentifier.toString();
|
indicator = workItemIdentifier ? workItemIdentifier.toString() : null;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "cycle": {
|
case "cycle": {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue