posthog icon indicating copy to clipboard operation
posthog copied to clipboard

Toolbar URL input is empty in edit mode

Open corywatilo opened this issue 1 year ago • 3 comments

Bug description

Toolbar URL input doesn't populate when editing an existing URL

2023-12-14 16 56 54

corywatilo avatar Dec 14 '23 21:12 corywatilo

Hey @corywatilo , I see this issue is still there. I think this is happening because of line 188 in authorizedUrlListLogic.ts or line 63 in AuthorizedUrlList.tsx. Instead of a empty string, the field should be loaded with urlToEdit value from the state when in edit mode. I can take a look and create a PR for this if you want to assign this to me.

Screen Shot 2024-04-24 at 8 08 21 PM

battisbog avatar Apr 25 '24 00:04 battisbog

Hey @battisbog , feel free to submit a PR. We don't actually assign issues around here, anyone can work on anything.

mariusandra avatar Apr 25 '24 07:04 mariusandra

I see a couple of issues here.

  1. The form is being rendered on initial load and only made visible on clicking the edit button. Hence it is not pre-populating with the urlToEdit when set as defaultValue.
  2. According to kea documentation (https://keajs.org/docs/react/useValues), useValues should trigger a rerender of the comoponent everytime a value changes, but when I add urlToEdit or editUrlIndex in useValues, the form does not rerender.
  3. If we use value instead of defaultValue and add an onChange to edit the text, the form gets pre-populated, but any following changes do not update the proposedUrl.
  4. There is another issue with the form that if you edit an url and save, it gets added as a new url instead of updating the existing one. If anyone has any suggestions I would love to know.

battisbog avatar Apr 30 '24 00:04 battisbog