-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed an issue with state updates in RiskActionPlanner (#1273)
- Loading branch information
Showing
5 changed files
with
55 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 9 additions & 2 deletions
11
SharePointFramework/ProjectExtensions/src/riskAction/components/RiskAction/useRiskAction.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,17 @@ | ||
import { useId } from '@fluentui/react-components' | ||
import { useState } from 'react' | ||
import { useMemo, useState } from 'react' | ||
import { useRiskActionFieldCustomizerContext } from '../../context' | ||
|
||
export function useRiskAction() { | ||
const fluentProviderId = useId('risk-action-fluent-provider') | ||
const context = useRiskActionFieldCustomizerContext() | ||
const [itemContext, setItemContext] = useState(context.itemContext) | ||
return { fluentProviderId, context: { itemContext, setItemContext } } | ||
const contextValue = useMemo( | ||
() => ({ | ||
itemContext, | ||
setItemContext | ||
}), | ||
[itemContext] | ||
) | ||
return { fluentProviderId, contextValue } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters