Giter VIP home page Giter VIP logo

issues_with_turbo_permanent_and_stimulus_connect's Introduction

README

Setup

  • bundle
  • yarn
  • bin/dev

View The Issue

  • Visit http://localhost:3000/yes
  • Click the link to visit the 'no' page
  • See the error in the browser console
  • Click the link to visit the 'yes' page
  • See the error in the browser console

The same behavior can be seen by starting with the 'no' page.

If the connect function is delayed, the error will not occur (confirmed with delayed_controller.js and its browser console output).

The error will not occur for the Stimulus controller that's connected to the initial rendering (permanent_controller.js).

Verify The Issue

  • Uncomment debugger in hide_controller.js
  • Refresh the page while on the 'yes' page
  • Click the link to go to the 'no' page
  • Run document.getElementById('item') in the browser console ... it will return null
  • Then run document & navigate into the html->body ... you will see <meta name="turbo-permanent-placeholder" content="container">

Secondary Issue/Question

I notice the delayed_controller.js doubles up its browser console output, and I don't know why.

Background Info

I use this approach to keep a single instance of Mapbox GL JS on the page throughout a user's visit.

If your journey starts on a page with a map, then that permanent_controller.js does all the work to initialize the map.

If your journey starts on a page without a map, then it does not initialize a map & hide_controller.js ensures the hidden class is present. Whenever you do navigate to a page with a map on it, there's a controller that initializes the map if it isn't already initialized and removes the hidden class.

issues_with_turbo_permanent_and_stimulus_connect's People

Contributors

jameschevalier avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.