Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to see the progress using "gatsby-plugin-nprogress" #4818

Closed
sachingvit opened this issue Apr 3, 2018 · 22 comments
Closed

Unable to see the progress using "gatsby-plugin-nprogress" #4818

sachingvit opened this issue Apr 3, 2018 · 22 comments

Comments

@sachingvit
Copy link

Description

I am trying to integrate "gatsby-plugin-nprogress" into my application, I have done mentioned configuration in gatsby-config.js to add the plugin. But I am not sure how to use it, how can I see loaded on page load and how to operate from applicstion.

Can anyone help me to integrate it within my application?

Steps to reproduce

Expected result

What should happen?

Actual result

What happened.

Environment

  • Gatsby version (npm list gatsby): [email protected]
  • gatsby-cli version (gatsby --version): 1.1.49
  • Node.js version: 8.9.3
  • Operating System: Windows

File contents (if changed):

gatsby-config.js: {
resolve: gatsby-plugin-nprogress,
options: {
color: red,
showSpinner: true,

  }

package.json:
gatsby-node.js:
gatsby-browser.js:
gatsby-ssr.js:

@ryanditjia
Copy link
Contributor

I see 2 possibilities:

  • Your connection is too fast. In Gatsby, the progress bar is hardcoded to only appear after 1s of delayed load. See: [gatsby-plugin-nprogress]: change default show delay #3368
  • I don’t know your complete gatsby-config.js. But it’s possible that you’ve made a syntactical error. It should be something like:
module.exports = {
  plugins: [
    {
      resolve: 'gatsby-plugin-nprogress',
      options: {
        showSpinner: false,
        trickle: false,
        minimum: 0.4,
      },
    },
    'your',
    'other',
    'plugins',
    'here',
  ]
}

@sachingvit
Copy link
Author

@ryanditjia Thanks for your comment here is my Repo

Your first concern sounds because I am not having a lots of data to load, but if I want to trigger the nprogress manually how can I do it? I have found some code snippet on internet so I had added it into gatsby-browser.js

Please check and tell me where I am wrong. I am totally new to this.

@sachingvit
Copy link
Author

@ryanditjia I had started the things but its not correct, I have to use this for page load time and API data fetch time also, but I want to have access on progress loader for some processes. How can I do that using single instance of "nprogress"

@KyleAMathews
Copy link
Contributor

The plugin isn't intended as something you can manually trigger. If you want to manually trigger nprogress, you can import nprogress directly and run it from your own code.

And like @ryanditjia mentioned, you'll only see it if the page load is > 1 second — you can simulate that by loading you site and then reducing the network speed in the devtools.

@sachingvit
Copy link
Author

@KyleAMathews @ryanditjia I had tried with mentioned way also reduced my connection speed to 1kbps but I am not able to see progress bar after removing manually call from gatsby-browser.js.

you can check my approach into Test repo

any hints what wrong there ?

@sachingvit
Copy link
Author

image

@pieh
Copy link
Contributor

pieh commented Apr 4, 2018

@sachingvit Progress bar will be only visible in build. In develop we don't need to fetch resources for other pages, so page changing will not be delayed and therefore progress bar will not show

@sachingvit
Copy link
Author

@pieh @ryanditjia @KyleAMathews I have done all mentioned in doc and suggested by you but this plugin is not working in my case. I had created the build and change the network speed to 10kbps. But unable to see the progress bar.
This time I had created a new Gatsby project and installed only "gatsby-plugin-nprogress"

Code Repo

@thebarty
Copy link

thebarty commented Apr 10, 2018

Any progress on this one? I am also NOT seeing any progress-indicator. Neither in production, nor locally via gastby build; gatsby serve (and then slowing things down in chrome developer tools).

Any idea what else to try?

@KyleAMathews
Copy link
Contributor

Can you check if you can trigger the progress bar on gatsbyjs.org? We have the plugin installed there.

@sachingvit
Copy link
Author

@thebarty Still I am unable to integrate the plugin, but I am able to see the progress bar on my page.
You can refer my repo and there is one gatsby-browser.js so I put some small logic there to trigger.

But top off that I am still unable to achieve the behavior of this plugin.

@KyleAMathews I am unable to see loader on gatsby.org

@pieh
Copy link
Contributor

pieh commented Apr 11, 2018

I just checked and it's working (for me) on gatsbyjs.org - https://cl.ly/0d0o0x420z03

@trafnar
Copy link

trafnar commented Jul 11, 2019

I've also failed to trigger this plugin, with a production build and throttled connection, so I have no way to know if it's working.

@zhiihan
Copy link

zhiihan commented Jul 28, 2019

I can't seem to trigger it either, though I also have no problem triggering the one on gatsby.org

@MeFelixWang
Copy link

I got the same problem, and I can't see it on gatsby.org neither.

@stewest
Copy link

stewest commented Feb 4, 2020

Yip, me neither. At first I thought was my browser's dark theme but I see the nprogress element doesn't exist in the dom anywhere - just the css.

@Ir1d
Copy link

Ir1d commented May 5, 2020

cant see it either, checked my zindex

@eesa1980
Copy link

eesa1980 commented May 9, 2020

For anyone who can't see the plugin, I had the same issue. To resolve it, you'll also need to install the the original plugin:

npm i gatsby-plugin-nprogress nprogress

once you've done that you can import the plugin's css file

import "nprogress/nprogress.css";

and either some customisation, or create your own css from scratch eg:

#nprogress {
  z-index: 10000;
  position: fixed;
  height: 100vh;
  width: 100vw;
  top: 0;
  left: 0;
  background: rgba(48, 48, 48, 0.9);
  color: teal;
}

#nprogress .bar {
  background: teal;
}

#nprogress .spinner-icon {
  border-top-color: teal;
  border-left-color: teal;
}

Hope this helps.

@chrisk8er
Copy link

I tried all solution but have no luck... 🙄

@BenQuirk
Copy link

Awesome plugin!

Can't confirm if it's working? How to test?

Install plugin, restart via 'gatsby develop', open in Chrome, right click inspect, devtools, Network tab, find 'throttle' section (might default to 'online') and change to slow 3G. Annnnd now you can see the plugin doing it's magic!

This would be great info to add to https://www.gatsbyjs.org/packages/gatsby-plugin-nprogress/

@Rajesh-Royal
Copy link

Rajesh-Royal commented Oct 7, 2020

You should make your #nprogress div at top of all events. Sometimes when your header is fixed it covers progress.

In my case I used this css:

#nprogress{
  position: fixed;
  z-index: 100000;
}

to debug open run your site build not develop and then set speed to 5kb/s. You shouldn't be using localhost. Once you start visiting pages open your inspect and at the very bottom of <body> tag you will see a new <div> with #nprogress Id.

Now you can debug and see what is the actual error.

image

you can see it on my gatsby portfolio https://developer-blog-ecommerce-gatsby.netlify.app/blog
It also on @Rajesh-Royal GitHub.

@dpw1
Copy link

dpw1 commented Apr 24, 2021

@ryanditji]

Is it possible to change the 1s value somehow? Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests