-
Notifications
You must be signed in to change notification settings - Fork 93
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
loading bar not display #15
Comments
No, there is no css files needed. All styles apply in an inline mode. Please take a look at the source code of the demo, it has a working example: |
Hi @mironov , Thank you very much for your reply. Here is my store js file
|
Hi @mironov , Here is my dependencies on package.json "dependencies": { |
@tarim Have you mounted the Loading Bar itself? You need to place it where you need it in the DOM: import LoadingBar from 'react-redux-loading-bar'
export default class Header extends React.Component {
render() {
return (
<header>
<LoadingBar />
</header>
)
}
} |
Hi @mironov , Yes, I did. I have header file
|
@tarim I don't see any promise middleware in your package.json. Do you use a custom middleware or you don't use it at all? Loading Bar will not be shown until you tell it to show using |
Hi @mironov , I used Redux-Thunk, please check my dependencies. Thank you, |
@tarim Sorry it's taking so long. I'd appreciate it if you can make a quick repo that I can take a look into. Please confirm that you're dispatching |
Hey @mironov, sweet progress bar. I am experiencing a similar issue. Inspecting the DOM, I can see that the bar is on the page, but both the I am testing without middleware for simplicity. Therefore, following the docs, I am doing: The
My combinereducers function includes:
And then in my actionCreator, where I am dispatching other actions:
Nothing happens 😢 As I said, it's on the page, it's just not being updated. |
Hey @markau, thank you! Have you installed the loading bar reducer? Please take a look at this barebones example of the usage without middleware: https://github.com/mironov/react-redux-loading-bar-barebones-example Required steps:
That should make it. |
Hi @mironov , I checked page DOM, and, the div tag is exist. but width is never change. Thank you.
|
@mirinov you're right, I did not have the reducer in my combine reducers function. (I am sure I did at some stage!). Anyway, I'm pleased to confirm it's all working. Cheers. |
Hi @mironov , Yes, it is already installed to my reducer.
|
Hi @mironov , Any suggestion please? Thanks, |
Hi @mironov , I added redux-promise-middleware, but still no luck.
|
@tarim Please copy here the code that invokes |
@mironov , I don't have any showLoading() action. I used middleware( because I don't like add show and hide action each action). Thank you, |
Hi @mironov , before I add your loading bar, I used http://milworm.github.io/react-progress-2/ . It is working fine. But, you have add show and hide to each actions. So, I decided use yours. Thanks, |
@tarim Oh that explains everything! Sorry, I should make it more clear in the readme. The If you don't want to use any promise middleware, you should dispatch Hope that clears things up. |
@mironov , I got your point, but, I added promise middleware(because I don't like to add show hide to each actions). So, I don't know why, it still not show up. Or, did I missing something? Thank you, |
@tarim What action do you dispatch using the promise middleware? |
@mironov , I changed my code, removed middleware, and added showLoading and hideLoading. But, it still not show up. Reducer part and header part not change at all. Here is my code please have a look.
|
@tarim That's probably because You might want to hide loading bar after response received: import axios from 'axios';
import { Promise } from 'es6-promise';
import { showLoading, hideLoading } from 'react-redux-loading-bar';
export function getUser() {
return function (dispatch) {
dispatch(showLoading());
axios.get('/api/v1/Account/User').then(response => {
dispatch(getUserSuccess(response));
dispatch(hideLoading());
}).catch(err => {
if (err.data) dispatch(authErrorSuccess(err.data.message));
else toastr.error(err.message, 'System', { timeOut: 5000 });
dispatch(hideLoading());
});
}
} |
Hi @mironov , Thank you for your help. It is working now. But, it is almost same as my old one. Do you have any example with promise middleware please? |
@tarim There is an example here: The idea is to return a fetch promise in your action and the promise middleware will dispatch |
Hi @mironov , It looks like not easy to implement on my application. Is there any possibility to handle with state data value?
So, the loding bar control by isLoading value. What do you think? Is that possible to this way?? Thanks, |
@tarim Yes, it is possible to do so in a custom middleware. Something like: import { showLoading, hideLoading } from 'react-redux-loading-bar'
export default function loadingBarMiddleware(config = {}) {
return ({ dispatch }) => next => action => {
if (action.isLoading === true) {
dispatch(showLoading())
} else if (action.isLoading === false) {
dispatch(hideLoading())
}
return next(action)
}
} It listens for all actions and dispatches |
@tarim I'm going to close the issue as there's nothing to fix here. Feel free to re-open if you still experience the problem. |
@mironov , Thank you very much for your help. |
Hi @mironov .Thanks for your awesome work.I am facing a small issue in my app.I have tried all of your soultions. but the loading bar is not displaying.These are the various files that am using, store.js
reducers.js
action.js
app.js
But when i inspect the browser.,i am able to see the component.But not able see the component in the app.What is missing here? |
Hi @muhzi4u, the reducer is installed correctly but the middleware should be installed as However, the middleware is only needed if you use some kind of That doesn't explain why the loading bar is hidden though. |
Hi @mironov .It is working after when i change |
it is not working i did as mentioned |
Hi,
I tried all of your description, but, the loading bar is not display. Do I need any css file or so? Please need your help.
Thanks,
The text was updated successfully, but these errors were encountered: