diff --git a/CHANGELOG.json b/CHANGELOG.json index 33e6380a2..ced3fac93 100644 --- a/CHANGELOG.json +++ b/CHANGELOG.json @@ -1,5 +1,24 @@ { "versions": [ + { + "version": "3.21.0", + "changes": { + "new": [], + "enhancements": [], + "fixes": [ + "`ListItemComments`: Can't select text from comment [#1874](https://github.com/pnp/sp-dev-fx-controls-react/issues/1874)", + "`Localization`: Bad translations in DateTimePicker control [#1909](https://github.com/pnp/sp-dev-fx-controls-react/issues/1909)", + "`WebPartTitle`: Control Fails to Update After Initial Save [#1877](https://github.com/pnp/sp-dev-fx-controls-react/issues/1877)", + "`DynamicForm`: Creating a document set sometimes throws a 409 save [#1919](https://github.com/pnp/sp-dev-fx-controls-react/issues/1919)" + ] + }, + "contributions": [ + "[Alessandro Chiavarino](https://github.com/Alesso-Chiavarino)", + "[Antanina Druzhkina](https://github.com/Ateina)", + "[EnablingLogic](https://github.com/EnablingLogic)", + "[Martin Lingstuyl](https://github.com/martinlingstuyl)" + ] + }, { "version": "3.20.0", "changes": { diff --git a/CHANGELOG.md b/CHANGELOG.md index a9adba88b..28c27965f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Releases +## 3.21.0 + +### Fixes + +- `ListItemComments`: Can't select text from comment [#1874](https://github.com/pnp/sp-dev-fx-controls-react/issues/1874) +- `Localization`: Bad translations in DateTimePicker control [#1909](https://github.com/pnp/sp-dev-fx-controls-react/issues/1909) +- `WebPartTitle`: Control Fails to Update After Initial Save [#1877](https://github.com/pnp/sp-dev-fx-controls-react/issues/1877) +- `DynamicForm`: Creating a document set sometimes throws a 409 save [#1919](https://github.com/pnp/sp-dev-fx-controls-react/issues/1919) + +### Contributors + +Special thanks to our contributors (in alphabetical order): [Alessandro Chiavarino](https://github.com/Alesso-Chiavarino), [Antanina Druzhkina](https://github.com/Ateina), [EnablingLogic](https://github.com/EnablingLogic), [Martin Lingstuyl](https://github.com/martinlingstuyl). + ## 3.20.0 ### Enhancements diff --git a/docs/documentation/docs/about/release-notes.md b/docs/documentation/docs/about/release-notes.md index a9adba88b..28c27965f 100644 --- a/docs/documentation/docs/about/release-notes.md +++ b/docs/documentation/docs/about/release-notes.md @@ -1,5 +1,18 @@ # Releases +## 3.21.0 + +### Fixes + +- `ListItemComments`: Can't select text from comment [#1874](https://github.com/pnp/sp-dev-fx-controls-react/issues/1874) +- `Localization`: Bad translations in DateTimePicker control [#1909](https://github.com/pnp/sp-dev-fx-controls-react/issues/1909) +- `WebPartTitle`: Control Fails to Update After Initial Save [#1877](https://github.com/pnp/sp-dev-fx-controls-react/issues/1877) +- `DynamicForm`: Creating a document set sometimes throws a 409 save [#1919](https://github.com/pnp/sp-dev-fx-controls-react/issues/1919) + +### Contributors + +Special thanks to our contributors (in alphabetical order): [Alessandro Chiavarino](https://github.com/Alesso-Chiavarino), [Antanina Druzhkina](https://github.com/Ateina), [EnablingLogic](https://github.com/EnablingLogic), [Martin Lingstuyl](https://github.com/martinlingstuyl). + ## 3.20.0 ### Enhancements diff --git a/package-lock.json b/package-lock.json index dd520320c..773079982 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@pnp/spfx-controls-react", - "version": "3.20.0", + "version": "3.21.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@pnp/spfx-controls-react", - "version": "3.20.0", + "version": "3.21.0", "hasInstallScript": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index d478830f2..8a9513d87 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@pnp/spfx-controls-react", "description": "Reusable React controls for SharePoint Framework solutions", - "version": "3.20.0", + "version": "3.21.0", "node": ">=16.13.0 <17.0.0 || >=18.17.1 <19.0.0", "scripts": { "build": "gulp build", diff --git a/src/common/telemetry/version.ts b/src/common/telemetry/version.ts index 973422cf1..57cd50645 100644 --- a/src/common/telemetry/version.ts +++ b/src/common/telemetry/version.ts @@ -1 +1 @@ -export const version: string = "3.20.0"; \ No newline at end of file +export const version: string = "3.21.0"; \ No newline at end of file diff --git a/src/controls/dynamicForm/DynamicForm.tsx b/src/controls/dynamicForm/DynamicForm.tsx index 6ec8dee3c..4aaa6a403 100644 --- a/src/controls/dynamicForm/DynamicForm.tsx +++ b/src/controls/dynamicForm/DynamicForm.tsx @@ -33,7 +33,7 @@ import "@pnp/sp/content-types"; import "@pnp/sp/folders"; import "@pnp/sp/items"; import { IFolder } from "@pnp/sp/folders"; -import { IInstalledLanguageInfo } from "@pnp/sp/presets/all"; +import { IInstalledLanguageInfo, IItemUpdateResult, IList } from "@pnp/sp/presets/all"; import { cloneDeep, isEqual } from "lodash"; import { ICustomFormatting, ICustomFormattingBodySection, ICustomFormattingNode } from "../../common/utilities/ICustomFormatting"; import SPservice from "../../services/SPService"; @@ -56,6 +56,10 @@ const getstyles = classNamesFunction const getFieldstyles = classNamesFunction(); const theme = getFluentUIThemeOrDefault(); +const timeout = (ms: number): Promise => { + return new Promise((resolve) => setTimeout(resolve, ms)); +}; + /** * DynamicForm Class Control */ @@ -626,7 +630,7 @@ export class DynamicFormBase extends React.Component< // Set the content type ID for the target item objects[contentTypeIdField] = contentTypeId; // Update the just created folder or Document Set - const iur = await library.items.getById(folderId).update(objects); + const iur = await this.updateListItemRetry(library, folderId, objects); if (onSubmitted) { onSubmitted( iur.data, @@ -704,7 +708,7 @@ export class DynamicFormBase extends React.Component< // Set the content type ID for the target item objects[contentTypeIdField] = contentTypeId; // Update the just created file - const iur = await library.items.getById(fileId).update(objects); + const iur = await this.updateListItemRetry(library, fileId, objects); if (onSubmitted) { onSubmitted( iur.data, @@ -1537,6 +1541,30 @@ export class DynamicFormBase extends React.Component< const folder = sp.web.getFolderByServerRelativePath(`${serverRelativeLibraryPath}/${normalizedFolderPath}`); return folder; }; + + /** + * Updates a list item and retries the operation if a 409 (Save Conflict) was thrown. + * @param list The list/library on which to execute the operation + * @param itemId The item ID + * @param objects The values to update the item with + * @param retry The retry index + * @returns An update result + */ + private updateListItemRetry = async (list: IList, itemId: number, objects: {}, retry: number = 0): Promise => { + try { + return await list.items.getById(itemId).update(objects); + } + catch (error) + { + if (error.status === 409 && retry < 3) { + await timeout(100); + return await this.updateListItemRetry(list, itemId, objects, retry + 1); + } + + throw error; + } + } + } export const DynamicForm = styled( diff --git a/src/controls/listItemComments/components/Comments/useListItemCommentsStyles.ts b/src/controls/listItemComments/components/Comments/useListItemCommentsStyles.ts index 4469856d5..beefed387 100644 --- a/src/controls/listItemComments/components/Comments/useListItemCommentsStyles.ts +++ b/src/controls/listItemComments/components/Comments/useListItemCommentsStyles.ts @@ -52,6 +52,7 @@ export const useListItemCommentsStyles = (): returnObjectStyles => { marginBottom: 7, width: 322, backgroundColor: theme.neutralLighterAlt, + userSelect: "text", ":hover": { borderColor: theme.themePrimary, borderWidth: 1, @@ -64,6 +65,7 @@ export const useListItemCommentsStyles = (): returnObjectStyles => { marginBottom: 7, width: 322, backgroundColor: theme.themeLighter, + userSelect: "text", border: "solid 3px "+theme.themePrimary, ":hover": { borderColor: theme.themePrimary, diff --git a/src/controls/webPartTitle/WebPartTitle.tsx b/src/controls/webPartTitle/WebPartTitle.tsx index b4b57d0ae..5a30431d7 100644 --- a/src/controls/webPartTitle/WebPartTitle.tsx +++ b/src/controls/webPartTitle/WebPartTitle.tsx @@ -54,7 +54,7 @@ export class WebPartTitle extends React.Component {
{ this.props.displayMode === DisplayMode.Edit && ( -