I'm trying to get stuff working but I can't success.
Initially I get the following error :
<Provider> does not support changing `store` on the fly. It is most likely that you see this error because you updated to Redux 2.x and React Redux 2.x which no longer hot reload reducers automatically.
See https://github.com/reactjs/react-redux/releases/tag/v2.0.0 for the migration instructions.
I followed instructions on the page, it was hard to understand that I had to put the store creation in the index.android.js and pass it as a prop, where the HMR does not rerender stuff so the store is not created again. But I finally get rid of the error.
I can now see that my store is update in the module.hot.accept function in the App/Redux/createStore function when I change any reducer, the App/Redux/SearchRedux initial state for exemple.
But my application state is not refreshed at all if I edit a reducer ! Even worst, when I do that the whole app gets disconnected from the state (but I havn't exemple on this simpler app so lets focus on the state not getting reinjected).
I can see it in App/Navigation/ReduxNavigation
You can reproduce the bug easily by cloning the repo.
I struggle on this one since this morning, time starts to be long so I finally post on SO. I've read a lot of stuff related to this issue but its obvious I'm missing something.
PS: Initially I wrote this with many links to the files so you can directly see what I mean with code. But I have few reputation despite I use the site for few years (because I always found answers, not this time)
You will find this question with the links in the repo readme, it will be easier to see files I'm talking about.
Thanks
Related
17/08/2021, no issues.
18/08/2021: For some reason overnight, there has been 0 changes in the code itself,
const pdfjsLib = window['pdfjs-dist/build/pdf']
pdfjsLib.GlobalWorkerOptions.workerSrc = '//mozilla.github.io/pdf.js/build/pdf.worker.js'
pdfjsLib stays undefined in the Electron app version of the application.
However, in the browser version, there is still no issue.
Hence, we can't work with PDFs anymore in the app. Who can explain how it suddenly doesn't work anymore after 1 year, and even better, who has a solution for this?
I think you are having the same issue that prompted my SO question last year: as mentioned here you "You should never directly link to mozilla.github.io/pdf.js since it changes on every push to master."
Not that a direct install is flawless, mind you: I came here today to ask about it again, and your question came up for a possible duplicate before posting.
Recently all my Shopify apps have stopped working due to this error. I can still pull data from the api (photos, titles, etc) but I can no longer add items to my cart or check out. this error isn't just happening on my current build but previous builds too. I think I might have made too many requests due to refreshing pages and have been banned from the API temporarily (I've had this happen with another API before). but it's now been 2 days and still no fix.
I'm pretty confident there's nothing wrong with my code because it's happening to other websites that were working before & haven't been touched for a while.
package used: "shopify-buy": "^2.11.0"
Thanks,
Mitchell D
turns out this error occurred because I was in PAUSE AND BUILD mode. so I must be on a plan to add items to the cart using the API? they must have made this change recently
I have a ReactNative app that is working with some constants,
export const BEARER_TOKEN = 'eyJhbGciOiJIU***'
The app works fine until I need to update the token so with a new version distributed by appcenter,
If I just update the app, it keeps the old token
but
If I delete and install a new version, the new token is used
So, how can I make sure that the new token gets loaded? like if the app starts reload constants?
Thanks.
I suggest using Asyncstorage and Redux state in order to maintain your Bearer_Token.
For instance, assume using the Facebook app.
You are logging in for the very first time. Capture and store your Bearer_token in Asyncstorage and also maintain in the redux state.
Next time when you kill the app and open again. Load the Bearer_Token from Asyncstorage.
Your Bearer_Token will be set dynamically.
You can't, with this approach. This is the nature of javascript, it loads everything initially and even if you change it by putting the variable in object. It is a bad practice.
The better approach is to use redux or context api,
I see you want to use BEARER_TOKEN, for user authentication probably.
So you can have a state, authUser inside your redux and it will keep track of the token in your entire app. This approach is very useful when you want the user to logout if any change in authToken.
https://redux.js.org/
For a simple version, you can use context api from react.
now the third option, If you really really really want to not use these approaches.
You can just usewindow.token = 'sdfasdf';
then whenever you want to change it, just use window.token = 'soemthing else'from other files.
I'm actually working on a mobile app with Ionic 3, everything is ok till now. Eveything work fine. I set translation with ngx-translate. So i got all my files in a folder "/assets/i18n/". I can call my data in templates or components so everything is ok.
But my client, wants that those translation files come from a web API. SO they can update them as they want. I searched here on found some things like this link "Ngx-translate - TranslateHttpLoader with external URL" ( I didn't want to answer this topic cause I don't have answer, just questions and as my profile is new I can't comment it )
I read all of this but i can't understand it perfectly so, i keep missing something, so please how can i create a custom loader for calling those translation file ?
I tried to create a provider/service but is that a specific kind of file for a loader ? Where to put it in my app ?
That's the last stop for my app to run. So please if someone know the answer can you help me a little bit with it ? I want to understand exactly how to call those json film from URL !
I can add more code if you want, but actually i got no error i just don't know how to create this "loader" from last topic. And where to put it.
Let's say I have a plugin Foo in osclass. In that plugin we register a hook for when an item is posted. According to the osclass hooks documentation the only hook that is run when an item is posted is posted_item.
But as far as I can tell from looking at the code this is run after the initial item data has already been validated and stored in the database. What if a validation of some plugin specific code fails and I would like to show the user an error message and present him with the form again to give him/her the chance to alter this information? Much like if you try to submit a new item but don't fill in one of the base information like description for instance.
I can't seem to find a way to do this. Only workaround I find to avoid the item being posted despite containing invalid plugin specific data, without editing the main osclass code, is to delete the posted item again in the posted_item hook callback function of my plugin. This feels extremely cumbersome and also requires every other plugin to check that the item still exists to make sure they don't save data connected to an item that is now deleted.
What I would like, and wonder if I have missed, is a hook that is run when an item is posted but before it's written to the database and have the ability to generate "errors" that would cause the item to not be posted and the user redirected back to the form with the "error" displayed just like for the basic item information.
Anyone have a solution I have missed? This feels like a very important part of plugins and without it posted items could become very fragmented.
A user on the osclass forums (teseo) told me about the undocumented hook pre_item_add that can be used.
<?php
function cust_my_plugin($aItem) {
osc_add_flash_error_message('My plugin has a complaint.');
$pItem = new CWebItem();
$pItem->redirectTo( osc_item_post_url() );
}
osc_add_hook('pre_item_add', 'cust_my_plugin');
?>
He also sais
The only bad news is that you can't merge your plugin validation
process with that of the core script, so if the ad had an error
related to your plugin and other errors, it would be rejected twice,
one by your plugin, the second by the core script. I couldn't see any
workaround for this little issue.