Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Link to navigate to object settings is broken #6213

Closed
FelixMalfait opened this issue Jul 11, 2024 · 3 comments · Fixed by #6228
Closed

Link to navigate to object settings is broken #6213

FelixMalfait opened this issue Jul 11, 2024 · 3 comments · Fixed by #6228
Labels
good first issue Good for newcomers scope: front Issues that are affecting the frontend side only

Comments

@FelixMalfait
Copy link
Member

Steps to reproduce:

  1. Create a new object called "Test 2"
  2. Go to that object's list view
  3. Click on "Customize Fields"
Screenshot 2024-07-11 at 07 45 54 4. You'll get a 404 because it redirects to http://localhost:3001/settings/objects/test2 instead of http://localhost:3001/settings/objects/test-2 Screenshot 2024-07-11 at 07 46 47

We probably hardcoded the url and passed the wrong variable. We should let the Router build the url if possible and share a common logic between the 2 page. Do something as clean/robust as possible.

@FelixMalfait FelixMalfait added type: bug good first issue Good for newcomers scope: front Issues that are affecting the frontend side only labels Jul 11, 2024
Copy link
Contributor

greptile-apps bot commented Jul 11, 2024

To fix the broken link for navigating to object settings, update the URL construction to use the getObjectSlug utility function. This ensures consistent slug formatting. Specifically, update the to prop in SettingsObjectItemTableRow and SettingsObjectFieldItemTableRow components.

  1. In SettingsObjects.tsx, modify the to prop in SettingsObjectItemTableRow:
<SettingsObjectItemTableRow
  key={activeObjectMetadataItem.namePlural}
  objectItem={activeObjectMetadataItem}
  action={<StyledIconChevronRight size={theme.icon.size.md} stroke={theme.icon.stroke.sm} />}
  to={`/settings/objects/${getObjectSlug(activeObjectMetadataItem)}`}
/>
  1. In SettingsObjectDetail.tsx, modify the to prop in SettingsObjectFieldItemTableRow:
<SettingsObjectFieldItemTableRow
  key={activeMetadataField.id}
  identifierType={getFieldIdentifierType(activeMetadataField, activeObjectMetadataItem)}
  variant={activeObjectMetadataItem.isCustom ? 'identifier' : 'field-type'}
  fieldMetadataItem={activeMetadataField}
  isRemoteObjectField={activeObjectMetadataItem.isRemote}
  to={`./${getFieldSlug(activeMetadataField)}`}
  ActionIcon={
    <SettingsObjectFieldActiveActionDropdown
      isCustomField={!!activeMetadataField.isCustom}
      scopeKey={activeMetadataField.id}
      onEdit={() => navigate(`./${getFieldSlug(activeMetadataField)}`)}
      onSetAsLabelIdentifier={canBeSetAsLabelIdentifier ? () => handleSetLabelIdentifierField(activeMetadataField) : undefined}
      onDeactivate={isLabelIdentifier ? undefined : () => handleDisableField(activeMetadataField)}
    />
  }
/>

This ensures that the URLs are correctly formatted and navigates to the appropriate object settings page.

References

/packages/twenty-front/src/pages/settings/data-model/SettingsObjects.tsx
/packages/twenty-front/src/pages/settings/data-model/SettingsObjectDetail.tsx
/packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsObjectFieldItemTableRow.tsx

About Greptile

This response provides a starting point for your research, not a precise solution.

Help us improve! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

Ask Greptile · Edit Issue Bot Settings

@saloni0419
Copy link

@FelixMalfait can i work on this issue

@rostaklein
Copy link
Contributor

Ah, sry @saloni0419 Ive fixed this in the meantime #6228 hope you dont mind and will take another issue 😉

FelixMalfait pushed a commit that referenced this issue Jul 11, 2024
fixes #6213

fixed the mentioned case + tried to find&fix other possible broken links
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers scope: front Issues that are affecting the frontend side only
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants