Comments (16)
Yes, you found a bug.
I released a new version, try it out.
from react-pages.
While your commit does fix this particular issue, it seems that it is currently not possible to pass query parameters to the destination at all. Fortunately I don't need them right now, but is there any way we could get that to work as well? Out of interest I tried require('url').format({ pathname: '/bar', query: { bar: null }, state: null })
earlier, but it produces ?bar=
as the search string, whereas it was originally just ?bar
without the =
. So it wouldn't really be the original query.
from react-pages.
I don't understand the it seems that it is currently not possible to pass query parameters to the destination at all
issue.
If you can explain it by an example I could take a look.
from react-pages.
The new changes result in this behavior:
% curl -vvv 'http://localhost:3002/foo?a&b=c'
* Trying ::1...
* Connected to localhost (::1) port 3002 (#0)
> GET /foo?a&b=c HTTP/1.1
> Host: localhost:3002
> User-Agent: curl/7.49.1
> Accept: */*
>
< HTTP/1.1 302 Found
< Location: /bar
< Content-Type: text/html; charset=utf-8
< Content-Length: 39
< Date: Mon, 10 Oct 2016 11:53:54 GMT
< Connection: keep-alive
<
* Connection #0 to host localhost left intact
Redirecting to <a href="/bar">/bar</a>.
All query parameters are lost in the redirect.
from react-pages.
Correction: they were lost even before your change. However, I feel like both issues should be fixed right now if possible. However, I took a quick look at redux-router's source code, and I'm not sure if they're giving us the original, unparsed query at all. So it might be difficult.
from react-pages.
The intention of the original code clearly is to pass the query parameters. However that is not happening right now at all as far as I can see.
from react-pages.
Well, it's working for me:
http://127.0.0.1:3000/example/database?a=b
<Redirect from='/example/database' to='/example/simple'/>
from react-pages.
I assume that's https://github.com/halt-hammerzeit/webapp. Doesn't it use webpack-isomorphic-tools
for server side rendering?
from react-pages.
Yes, it does
from react-pages.
Then it probably doesn't suffer from the same issue as react-isomorphic-render
?
I think https://github.com/halt-hammerzeit/webpack-react-redux-isomorphic-render-example would be more relevant as it uses react-isomorphic-render
. You can see the same problem there:
% curl -vvv 'http://localhost:3000/example/database?a&b=c'
* Trying ::1...
* connect to ::1 port 3000 failed: Connection refused
* Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 3000 (#0)
> GET /example/database?a&b=c HTTP/1.1
> Host: localhost:3000
> User-Agent: curl/7.49.1
> Accept: */*
>
< HTTP/1.1 302 Found
< location: /example/simpleundefined
< content-type: text/html; charset=utf-8
< content-length: 79
< date: Mon, 10 Oct 2016 12:25:37 GMT
< connection: close
<
* Closing connection 0
Redirecting to <a href="/example/simpleundefined">/example/simpleundefined</a>.
from react-pages.
webpack-isomorphic-tools
and react-isomorphic-render
have nothing in common
from react-pages.
webpack-isomorphic-tools
doesn't know how to render anything
from react-pages.
Ok. Let's ignore webpack-isomorphic-tools since it's sidetracking the issue.
On a fresh clone of https://github.com/halt-hammerzeit/webpack-react-redux-isomorphic-render-example, you should be able to see the same redirect issue I posted earlier. Is there any chance we could get redirects with query parameters working there?
from react-pages.
Turned out webpack-react-redux-isomorphic-render-example
had 4.x
dependency of react-isomorphic-render
set in package.json
.
I upgraded it to 5.x
.
The other bug seems to be in react-router
:
@@@@@@@@@@@@@@ redirect_location { pathname: '/', query: { a: 'b' }, state: null }
It doesn't specify search
parameter.
https://github.com/ReactTraining/react-router/blob/c3cd9675bd8a31368f87da74ac588981cbd6eae7/modules/createTransitionManager.js#L100
############# redirectInfo { pathname: '/', query: { a: 'b' }, state: null }
I filed a bug report in their repo
remix-run/react-router#4023
A workaround could be written using query-string
's stringify()
https://www.npmjs.com/package/query-string
from react-pages.
Since they officially said that they aren't gonna fix this issue due to [email protected]
branch support being dropped I implemented my own workaround.
So it's fixed in the new version.
from react-pages.
Thanks, looks great! There's one small issue remaining, I added a comment to your commit. Basically now redirects without any query parameters get ?
always appended to them.
from react-pages.
Related Issues (20)
- Access store outside React scope HOT 4
- Adding json-ld script tags (dynamic) in SSR pages HOT 1
- Can't add custom handler for `@@react-isomorphic-render/goto` event HOT 4
- Error running npm install HOT 1
- The test is failed. (npm install) HOT 1
- usage directions fail at npm install babel-node HOT 1
- SSR middlewares HOT 2
- react-router problem HOT 7
- Http utility in Server Side HOT 11
- how can i run this site? HOT 8
- How modify @preload {client: true} configuration HOT 5
- How to capture an event type HOT 2
- Crash in long running production process (v 2.0.13) HOT 2
- Module not found: Error: Can't resolve './aboutPageReducer' in ...... HOT 1
- Error instantiating router HOT 5
- No way to detect authentication before using http client HOT 2
- [SSR] Access to the request headers HOT 4
- Enable configuration entry for HTTP `on_before_send` HOT 8
- Invalid Content-Type for get and multipart requests HOT 3
- Moving from isomorphic to website causes render service error HOT 12
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-pages.