Skip to content

Conversation

clairep94
Copy link
Collaborator

@clairep94 clairep94 commented Oct 10, 2025

Should be reviewed after #3681

Migration of the preferences (user preferences) redux reducer & migration of base redux reducer files

  • Approach was to grab the UserPreferences type to define the PreferencesState
  • Then use PreferencesState['somefield'] to get the type for somefield (which is defined by UserPreferences['somefield']
  • This allows us to use UserPreferences as the source of truth, and creates a link that can be traced from client to server.

Changes:

  • export types required in client defined in server to common
  • client/custom.d.ts
    • extend Window type to have redux devtools
    • extend NodeModules type to have hot reloading
  • client/persistState
  • client/reducers -- define RootReducer
  • client/store
  • delete client/storeInstance:
    • Isn't called anywhere else & relevant lines are in client/index.jsx here so it seems it may be outdated
  • client/modules/IDE/reducers/preferences:
    • take UserPreferences type defined in server as basis for PreferencesState
      • Please see comments re: slight misalignment between client & server (I think server is out of date and has some fields that are never used in client)
  • client/modules/IDE/actions/preferences:
    • take UpdatePreferencesRequestBody from common types
    • define types for actions and values in co-located file preferences.types
      • Defined from types required for associated PreferenceState properties

I have verified that this pull request:

  • has no linting errors (npm run lint)
  • has no test errors (npm run test)
  • is from a uniquely-named feature branch and is up to date with the develop branch.
  • is descriptively named and links to an issue number, i.e. Fixes #123
  • meets the standards outlined in the accessibility guidelines

…eferences to /userPreferences & add response and request types
…teCookiePreferences & move to /userPreferences
…e to /authmanagement and add request and response types
@clairep94 clairep94 added the pr05 Grant Projects pr05 Grant Projects label Oct 10, 2025
Comment on lines +9 to +12
export interface PreferencesState
extends Omit<Preferences, 'indentationAmount' | 'isTabIndent'> {
tabIndex: number;
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

There's a slight misalignment between the server & client here

It also seems like not all properties from either definition are exposed on the frontend currently:

Screenshot 2025-10-11 at 13 36 36 Screenshot 2025-10-11 at 13 36 41

Comment on lines +20 to +21
if (!stored) return null; // handle null before parsing
return JSON.parse(stored) as RootState;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

to handle type-error from getItem potentially returnning undefined

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

deleted as this file isn't called anywhere else

additionally the below lines are called in client/index.jsx here

@clairep94 clairep94 marked this pull request as ready for review October 11, 2025 17:44
@clairep94 clairep94 changed the title Pr05/migrate user preferences redux final pr05 Typescript Migration #15: Redux base files & migrate user preferences redux system Oct 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr05 Grant Projects pr05 Grant Projects

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant