Does this seem/feel hacky/

Hi, so browsing through this forum i have constructed this controller

  next(event) {
    if (event.detail.success) {
      if(this.hasNextValue) {
        Turbo.visit(this.nextValue);
      } else {
        const fetchResponse = event.detail.fetchResponse;

        history.pushState(
            { turbo_frame_history: true },
            "",
            fetchResponse.response.url
        );

        Turbo.visit(fetchResponse.response.url);
      }

    }
  }

When is this used? well we have a form and we want turbo to handle the error display when we return unprocessable_entity response. But, we want to change the url and so on. Does this feels hacky, not good?

thanks