Skip to content

fix(client): updated SocialProperty to edit, send and reset data fields#668

Merged
AAfghahi merged 5 commits intodevfrom
641-the-socialproperties-configuration-page-never-sends-the-user-data
Apr 10, 2025
Merged

fix(client): updated SocialProperty to edit, send and reset data fields#668
AAfghahi merged 5 commits intodevfrom
641-the-socialproperties-configuration-page-never-sends-the-user-data

Conversation

@j-arias-dev
Copy link
Copy Markdown
Contributor

@j-arias-dev j-arias-dev commented Mar 5, 2025

Description

Updated SocialProperty state to edit, send and reset data fields.

Changes Made

  • I removed the useForm in the SocialProperty and updated the fields to point to the state values so that we could track, edit, and submit the updated textField changes.
  • Updated the reset functionality by adding a refresh functionality that calls the getLoginProperties reactor.
  • Added error handling for modifyLoginProperties.

How to Test

  1. Go to the settings page
    Enter admin mode
    Click on configuration
    Select any authentication mode
    Enter value fields for the data
    Click save

  2. Expected outcomes

  • On the network console, test to see if modifyLoginProperties returns the updated payload values
  • For the reset functionality, test to see if the textField values reset to the last submitted value.

Notes

I noticed that we have a description text field for each login property, but I don't see a description value key being returned in the getLoginProperties reactor. Should we remove the description text field?

Also, I disabled the login key text field from being edited, but let me know if we want a user to be able to also edit the login key text field as well.

@j-arias-dev j-arias-dev linked an issue Mar 5, 2025 that may be closed by this pull request
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 5, 2025

@CodiumAI-Agent /describe

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 5, 2025

@CodiumAI-Agent /review

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 5, 2025

@CodiumAI-Agent /improve

@j-arias-dev j-arias-dev self-assigned this Mar 5, 2025
@j-arias-dev j-arias-dev marked this pull request as ready for review March 5, 2025 22:01
@j-arias-dev j-arias-dev requested a review from a team as a code owner March 5, 2025 22:01
@johbaxter johbaxter requested review from AAfghahi and removed request for johbaxter April 4, 2025 18:13
const StyledSearchIcon = styled(SearchOutlined)(({ theme }) => ({
color: '#5c5c5c',
}));
// const StyledSearchIcon = styled(SearchOutlined)({
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not delete this

Object.keys(socialProps),
);
const [authExpanded, setAuthExpanded] = useState(true);
// const [authExpanded, setAuthExpanded] = useState(true);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason to leave this commented out

@AAfghahi
Copy link
Copy Markdown
Contributor

AAfghahi commented Apr 4, 2025

are the reactors fully functional? The reset worked for me, but the save didn't seem to take. Is it waiting for a backend PR to merge?

@QodoAI-Agent
Copy link
Copy Markdown

PR Code Suggestions ✨

CategorySuggestion                                                                                                                                    Impact
Possible issue
Fix reset API mismatch

Align the function’s signature with its usage by either removing the parameter from
the call or updating the function to accept an argument.

packages/client/src/pages/settings/ConfigurationsPage.tsx [436-438]

 onClick={() => {
-    resetLoginProperties(fieldName);
+    resetLoginProperties();
 }}
Suggestion importance[1-10]: 8

__

Why: The suggestion correctly identifies a mismatch between the function signature of resetLoginProperties (which takes no parameters) and its usage; updating the call improves consistency and prevents potential runtime errors.

Medium
Prevent state mutation

Avoid direct state mutation by creating a deep clone of the state before modifying
it.

packages/client/src/pages/settings/ConfigurationsPage.tsx [257-258]

-const socialPropsCopy = socialProps;
-socialPropsCopy[fieldName][index]['value'] = value;
+const socialPropsCopy = { ...socialProps };
+socialPropsCopy[fieldName] = socialPropsCopy[fieldName].map((item, idx) => 
+    idx === index ? { ...item, value } : item
+);
Suggestion importance[1-10]: 8

__

Why: The suggestion addresses a significant issue by preventing direct state mutation through cloning the socialProps object, which improves code reliability and adheres to best practices in state management.

Medium

@AAfghahi AAfghahi merged commit e80a652 into dev Apr 10, 2025
3 checks passed
@AAfghahi AAfghahi deleted the 641-the-socialproperties-configuration-page-never-sends-the-user-data branch April 10, 2025 20:18
@github-actions
Copy link
Copy Markdown

@CodiumAI-Agent /update_changelog

@QodoAI-Agent
Copy link
Copy Markdown

Changelog updates: 🔄

2025-04-10

  • Fixed social properties state management and error handling.
  • Changed configuration UI by removing redundant fields and logic.

to commit the new content to the CHANGELOG.md file, please type:
'/update_changelog --pr_update_changelog.push_changelog_changes=true'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The social.properties configuration page never sends the user data

3 participants