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

Store not found in redux example. Example does not work #558

Open
briziel opened this issue Oct 2, 2019 · 11 comments
Open

Store not found in redux example. Example does not work #558

briziel opened this issue Oct 2, 2019 · 11 comments

Comments

@briziel
Copy link

briziel commented Oct 2, 2019

Hi,

Thank you for your awesome work. Found is great. But there is a problem with the the redux example (https://github.com/4Catalyzer/found/tree/master/examples/redux). It does not start. When i run yarn start, localhost:3000 opens in the Browser and there is the following error: "Could not find "store" in the context of "ConnectedRouter". Either wrap the root component in a , or pass a custom React context provider to and the corresponding React context consumer to ConnectedRouter in connect options."

Bildschirmfoto 2019-10-02 um 16 26 13

I have the same error in my application since i updated found and redux respectively. I just want to run the example that i have a working blueprint.

Maybe there is a easy solution for this error.

My Setup:
MacBook Pro
OSX Mojave 10.14.6 (18G95)

node -v v8.11.4
npm -v 6.11.3
yarn -v 1.15.2

best regards
Fabricius

@taion
Copy link
Contributor

taion commented Oct 2, 2019

Are you running the version of the example on master right now?

Most likely what's happening is that you have duplicate versions of react-redux installed. Can you run yarn why react-redux, and then eliminate the duplicate versions if so?

@briziel
Copy link
Author

briziel commented Oct 2, 2019

Hey, yes i was running the master version. I used yarn why react-redux:

[1/4] 🤔 Why do we have the module "react-redux"...?
[2/4] 🚚 Initialising dependency graph...
[3/4] 🔍 Finding dependency...
[4/4] 🚡 Calculating file sizes...
=> Found "react-redux@6.0.1"
info Has been hoisted to "react-redux"
info Reasons this module exists

  • Specified in "dependencies"
  • Hoisted from "found#react-redux"
    info Disk size without dependencies: "384KB"
    info Disk size with unique dependencies: "1.28MB"
    info Disk size with transitive dependencies: "1.36MB"
    info Number of shared dependencies: 9
    ✨ Done in 0.66s.

Maybe i am wrong, but this looks fine to me. I tried npm dedupe aswell, unfortunately with above-mentioned result.

@taion
Copy link
Contributor

taion commented Oct 3, 2019

Can you try this against a fresh clone of the repo?

If I do:

$ hub clone 4Catalyzer/found
$ cd examples/redux
$ yarn && yarn start

I get a working example page.

@hbilles
Copy link

hbilles commented Oct 4, 2019

Hi, thought I'd chime in as well. First off, I love found. We're currently using the found and farce packages in our react plus redux project (found v.0.3.21 and farce v0.2.6), and it works like a dream.

I recently tried updating both packages and ran into this issue (Cannot find "store" in the context of "ConnectedRouter".). Found this issue and tried running this example against a fresh clone of the repo as suggested by @taion . I get the exact same result as @briziel when attempting to run the example.

I tried updating the example project to found v.0.4.9 and farce to v0.2.8 as well as downgrading react-redux to v5.1.1 to no effect.

My setup:
MaxOS Mojave v10.14.6
node v10.16.0
npm v6.9.0

@taion
Copy link
Contributor

taion commented Oct 4, 2019

I updated all the dependencies in the examples in #564. Can you try again? The only meaningful change was https://github.com/4Catalyzer/found/pull/564/files#diff-7b2b83034007ff85c37ed91437658d37R87, which only affects SSR, so I'm not sure what the problem could be. I'm still not personally experiencing this.

If you're upgrading to the newest versions of Found, you'll also want to upgrade react-redux to v7.x. The examples now show this.

Could there be anything going on with using yarn link here?

@taion
Copy link
Contributor

taion commented Oct 4, 2019

Also, @hbilles, in your project, what do you get when you check for installed versions of react-redux?

@hbilles
Copy link

hbilles commented Oct 4, 2019

@taion , the updated example now appears to work for me.

I tried updating react-redux to v7 in my project and it still didn't work. I created a stripped-down test case which can be found here. The first commit uses the older versions of found v0.3.2.1, redux v4.0.0 and react-redux v5.1.1 and works. The current state of the repo throws the Could not find "store"... error using found v0.4.9, redux v4.0.4 and react-redux v7.1.1.

As for the installed versions of react-redux, I get react-redux@7.1.1
Screen Shot 2019-10-04 at 3 52 02 PM

Note there is nothing mounted at /. The path needs to be /requests to work.

Let me know if this should be made into a separate issue. Thanks!

@taion
Copy link
Contributor

taion commented Oct 4, 2019

Okay, it's odd that they're not deduped. For the moment, you can run npm dedupe to dedupe the requirements, which should fix the transient problem.

Let's keep this issue open for now, though. This is #244, which I initially resolved with #337 but ended up backing out because I wasn't sure it was necessary.

@hbilles
Copy link

hbilles commented Oct 4, 2019

Gotcha. Did that and the error went away. However, the path /requests now returns Not Found whereas it used to match previously.

@taion
Copy link
Contributor

taion commented Oct 4, 2019

This was one of the breaking changes in v0.4.0: https://github.com/4Catalyzer/found/releases/tag/v0.4.0

You need to add a child like

    children: [
      {},
      {
        path: 'payment/:id',
        Component: PaymentDetail,
      },
      {
        path: 'request/:id',
        Component: RequestDetail,
      },
    ],

We made "stem" routes no longer match on their own, because it was somewhat too error-prone.

@hbilles
Copy link

hbilles commented Oct 4, 2019

Yup, that's what it was. Missed that detail. Works like a charm now, thanks!

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

3 participants