posthog
posthog copied to clipboard
Toolbar URL input is empty in edit mode
Bug description
Toolbar URL input doesn't populate when editing an existing URL
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.
Hey @battisbog , feel free to submit a PR. We don't actually assign issues around here, anyone can work on anything.
I see a couple of issues here.
- 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.
- 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.
- 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.
- 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.