Update URL validation logic in LinkEditForm - #4389
ilBiondojs wants to merge 3 commits into
Conversation
|
@ilBiondojs is attempting to deploy a commit to the Umami Software Team on Vercel. A member of the Team first needs to authorize it. |
Greptile SummaryThis PR adds a validation check in
Confidence Score: 1/5Not safe to merge — the change introduces a compile-time syntax error that would break the build. The only modified file has two defects on the single changed line: a stray closing parenthesis that prevents TypeScript compilation, and a scoping mistake that would make the new validation guard a no-op even after the syntax is fixed. The PR cannot ship in its current state. src/app/(main)/links/LinkEditForm.tsx — the Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[User submits form] --> B[checkUrl called with url]
B --> C{isValidUrl url}
C -- No --> D[Return invalidUrl error]
C -- Yes --> E{url equals hostUrl/slug}
E -- Yes --> D
E -- No --> F[Return true - valid]
G[slug defined inside Form render-prop] -. slug is undefined at checkUrl scope .-> E
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
A[User submits form] --> B[checkUrl called with url]
B --> C{isValidUrl url}
C -- No --> D[Return invalidUrl error]
C -- Yes --> E{url equals hostUrl/slug}
E -- Yes --> D
E -- No --> F[Return true - valid]
G[slug defined inside Form render-prop] -. slug is undefined at checkUrl scope .-> E
|
|
Not sure if I get the correct value by getting it from formValues in the validation query. I didn't right understand how to get the data of the form in the validation query |
This is a fairly superficial fix. It prevents using the same forwarding URL as the primary link, but realistically it’s an unlikely scenario since no one would normally set identical values for both.
Need help on this PR? Tag
/codesmithwith what you need. Autofix is disabled.