bridgetownrb/bridgetown-view-component

Issue with bridgetown-v1.1.0 and view_component-v2.75.0 - [Bridgetown] Exception raised: TypeError [Bridgetown] no implicit conversion of nil into String

thanosbellos opened this issue ยท 4 comments

Hi I am following the quick installation guide, on a fresh project.

I added the example's view component and nothing else. But when I try to start server I encounter the following error:

Screenshot 2022-11-03 at 1 57 35 PM

Versions of all gems

GEM
  remote: https://rubygems.org/
  specs:
    actionview (7.0.4)
      activesupport (= 7.0.4)
      builder (~> 3.1)
      erubi (~> 1.4)
      rails-dom-testing (~> 2.0)
      rails-html-sanitizer (~> 1.1, >= 1.2.0)
    activemodel (7.0.4)
      activesupport (= 7.0.4)
    activesupport (7.0.4)
      concurrent-ruby (~> 1.0, >= 1.0.2)
      i18n (>= 1.6, < 2)
      minitest (>= 5.1)
      tzinfo (~> 2.0)
    addressable (2.8.1)
      public_suffix (>= 2.0.2, < 6.0)
    amazing_print (1.4.0)
    bridgetown (1.1.0)
      bridgetown-builder (= 1.1.0)
      bridgetown-core (= 1.1.0)
      bridgetown-paginate (= 1.1.0)
    bridgetown-builder (1.1.0)
      bridgetown-core (= 1.1.0)
    bridgetown-core (1.1.0)
      activemodel (>= 6.0, < 8.0)
      activesupport (>= 6.0, < 8.0)
      addressable (~> 2.4)
      amazing_print (~> 1.2)
      colorator (~> 1.0)
      erubi (~> 1.9)
      faraday (~> 1.0)
      faraday_middleware (~> 1.0)
      hash_with_dot_access (~> 1.2)
      i18n (~> 1.0)
      kramdown (~> 2.1)
      kramdown-parser-gfm (~> 1.0)
      liquid (~> 5.0)
      listen (~> 3.0)
      rake (>= 13.0)
      roda (~> 3.46)
      rouge (~> 3.0)
      serbea (~> 1.0)
      terminal-table (~> 1.8)
      thor (~> 1.1)
      tilt (~> 2.0)
      webrick (~> 1.7)
      zeitwerk (~> 2.5)
    bridgetown-paginate (1.1.0)
      bridgetown-core (= 1.1.0)
    bridgetown-view-component (1.0.0)
      actionview (>= 6.0)
      bridgetown (>= 1.0.0.beta3, < 2.0)
      view_component (>= 2.49)
    builder (3.2.4)
    colorator (1.1.0)
    concurrent-ruby (1.1.10)
    crass (1.0.6)
    erubi (1.11.0)
    faraday (1.10.2)
      faraday-em_http (~> 1.0)
      faraday-em_synchrony (~> 1.0)
      faraday-excon (~> 1.1)
      faraday-httpclient (~> 1.0)
      faraday-multipart (~> 1.0)
      faraday-net_http (~> 1.0)
      faraday-net_http_persistent (~> 1.0)
      faraday-patron (~> 1.0)
      faraday-rack (~> 1.0)
      faraday-retry (~> 1.0)
      ruby2_keywords (>= 0.0.4)
    faraday-em_http (1.0.0)
    faraday-em_synchrony (1.0.0)
    faraday-excon (1.1.0)
    faraday-httpclient (1.0.1)
    faraday-multipart (1.0.4)
      multipart-post (~> 2)
    faraday-net_http (1.0.1)
    faraday-net_http_persistent (1.2.0)
    faraday-patron (1.0.0)
    faraday-rack (1.0.0)
    faraday-retry (1.0.3)
    faraday_middleware (1.2.0)
      faraday (~> 1.0)
    ffi (1.15.5)
    hash_with_dot_access (1.2.0)
      activesupport (>= 5.0.0, < 8.0)
    i18n (1.12.0)
      concurrent-ruby (~> 1.0)
    kramdown (2.4.0)
      rexml
    kramdown-parser-gfm (1.1.0)
      kramdown (~> 2.0)
    liquid (5.4.0)
    listen (3.7.1)
      rb-fsevent (~> 0.10, >= 0.10.3)
      rb-inotify (~> 0.9, >= 0.9.10)
    loofah (2.19.0)
      crass (~> 1.0.2)
      nokogiri (>= 1.5.9)
    method_source (1.0.0)
    minitest (5.16.3)
    multipart-post (2.2.3)
    nio4r (2.5.8)
    nokogiri (1.13.9-arm64-darwin)
      racc (~> 1.4)
    public_suffix (5.0.0)
    puma (5.6.5)
      nio4r (~> 2.0)
    racc (1.6.0)
    rack (3.0.0)
    rails-dom-testing (2.0.3)
      activesupport (>= 4.2.0)
      nokogiri (>= 1.6)
    rails-html-sanitizer (1.4.3)
      loofah (~> 2.3)
    rake (13.0.6)
    rb-fsevent (0.11.2)
    rb-inotify (0.10.1)
      ffi (~> 1.0)
    rexml (3.2.5)
    roda (3.61.0)
      rack
    rouge (3.30.0)
    ruby2_keywords (0.0.5)
    serbea (1.0.1)
      activesupport (>= 6.0)
      erubi (>= 1.10)
      tilt (~> 2.0)
    terminal-table (1.8.0)
      unicode-display_width (~> 1.1, >= 1.1.1)
    thor (1.2.1)
    tilt (2.0.11)
    tzinfo (2.0.5)
      concurrent-ruby (~> 1.0)
    unicode-display_width (1.8.0)
    view_component (2.75.0)
      activesupport (>= 5.0.0, < 8.0)
      concurrent-ruby (~> 1.0)
      method_source (~> 1.0)
    webrick (1.7.0)
    zeitwerk (2.6.4)

PLATFORMS
  arm64-darwin-22

DEPENDENCIES
  bridgetown (~> 1.1.0)
  bridgetown-view-component (~> 1.0)
  puma (~> 5.6)

BUNDLED WITH
   2.3.24

As an experiment I also downloaded lookbook docs, that are build with bridgetown too.

When I upgraded the core gem to v1.1.0 I had the same issue. Their repo is still using bridgetown-v1.0.0.

Thanks in advance and I am glad to help with any more information you may need.

As a follow up, it seems to be an issue with the latest version of view_component(2.75.0)

Locking it manually to version 2.74.1, did the trick and everything worked as expected.

@thanosbellos the issue is ViewComponent::Base.config.view_component_path is nil and the gem probably needs to set that.

To fix, set the view_component_path, for instance:

ViewComponent::Base.config.view_component_path = "src/_components"

class Base < ViewComponent::Base
   # etc.
end

cc @jaredcwhite

v2.82.0 reverted Avoid loading ActionView::Base during initialization (introduced with v2.75.0) that seemed to be causing the issue.

@jaredcwhite I think we can close this issue.

I have this issue on VC 3.5.0 but @andrewmcodes's fix above works. Is this something we can fix in the code or is this something that should be documented?