[go: up one dir, main page]

Skip to content

Follow-up from "Prefetch pathLastCommit GraphQL with StartupJS"

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

The following discussion from !51429 (merged) should be addressed:

I'm a little bit hesitant about the combination:

current_route_path = request.fullpath.match(/-\/tree\/[^\/]+\/(.+$)/).to_a[1]
path: current_route_path || ""

I have two comments on that:

  1. I see in the GraphQL query annotation that the path is not required:

    query pathLastCommit($projectPath: ID!, $path: String, $ref: String!) {

    Maybe we can get away without the || "" guard since it is allowed to be nil?

  2. Is there any way to test this logic? When I see regexp that I can't immediately understand, I usually look for unit tests to see what input/output am I working with.

Edited by 🤖 GitLab Bot 🤖