veliovgroup / flow-router

🚦 Carefully extended flow-router for Meteor
https://packosphere.com/ostrio/flow-router-extra
BSD 3-Clause "New" or "Revised" License
202 stars 29 forks source link

Elasticsearch + Flow Router #50

Closed vpl-webteam closed 2 years ago

vpl-webteam commented 6 years ago

I am using elasticsearch for a search engine on our website with a react ui package from searchkit. The react package works based on the URL. When you use the filters for search it works correctly and filters to show the correct items. (url "/resorts?state[0]=Florida&state[1]=Texas")

Then when you click on the item it redirects you to the correct page, ("/resort/:resortId") but then when you try to go back ("/resorts?state[0]=Florida&state[1]=Texas") after a filter it stays on the redirected page.

You can only go back to the filter page after clicking back multiple times to the original main search. ("/resorts")

FlowRouter.route('/resorts/', {
  action: function (params, queryParams) {
      console.log(params, queryParams);

      mount(MainLayout, {
        content: () => (
            <ListOfResorts />
        ) 
      })
    }
});

ostrio:flow-router-extra@3.5.0 METEOR@1.6.1 All browsers and platforms

No errors in the console

dr-dimitru commented 6 years ago

Hello @vpl-webteam ,

I'm sorry for late reply. Do you still experiencing this issue? If so, I need more info to help you:

  1. How exactly redirect is implemented?

As I understood /resorts?getQuery redirects to /resort/:resortId. And when you trying to go back to /resorts?getQuery (by clicking back button), it redirects you again to /resort/:resortId, and only if you click back button quickly without giving a chance to FR to catch navigation you can pass it over.

If all above sounds correct, bad news - this is actually expected behavior. And here is good news - there is a way to remove /resorts?getQuery from history, and actually go to page before (lets say - go -2).

Here is some links for inspiration:

Let me know wdyt.

vpl-webteam commented 6 years ago

Yes still experiencing the issue.

The only part you are missing is that the user clicks on an item to go to the resort. They are seperate pages. /resorts/?getQuery is a search page. /resort/:resortId is an individual page. No matter how long you wait when you click back to view the previous search results it stays on the individual page until you reach the /resorts/ without the query.

dr-dimitru commented 6 years ago

@vpl-webteam

  1. What exact code do you use for redirect?
  2. How user gets to the /resorts/?getQuery page, and how get query is set?
vpl-webteam commented 6 years ago

Its in production. https://vacationpropertiesforless.com/resorts

Click on a few filters on the left side then the url and content changes. After adding filters you can click on a single resort and it goes to that page. When you click back it wont load the url query.

On Wed, Jul 11, 2018 at 5:27 PM dr.dimitru notifications@github.com wrote:

@vpl-webteam https://github.com/vpl-webteam

  1. What exact code do you use for redirect?
  2. How user gets to the /resorts/?getQuery page, and how get query is set?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/VeliovGroup/flow-router/issues/50#issuecomment-404315546, or mute the thread https://github.com/notifications/unsubscribe-auth/AjnSD73YQ9kLQuGJ6OVI_BvD-VrzXpefks5uFm3bgaJpZM4U2Uu4 .

dr-dimitru commented 6 years ago

@vpl-webteam could you please share a code you used behind the scene, for:

  1. Redirect?
  2. How query parameters are set?
vpl-webteam commented 6 years ago
  1. FlowRouter.go('resort', {resortId: this.props.id}) I also tried FlowRouter.go('/resort/' + props.Resort._id) both act the same.
  2. Url path is set using searchkit (https://github.com/searchkit/searchkit)
dr-dimitru commented 6 years ago

Hey @vpl-webteam ,

We just released v3.5.1, not sure if your specific issue would be fixed, but it worth trying.

But I would look into searchkit docs and try to disable it to hack into document.location and history, as you use FlowRouter, only FlowRouter should manipulate History API.

dr-dimitru commented 6 years ago

Marked as [helpwanted], hope someone from community members has faced the same issue and would help us here. It might be a good idea to repost it to the forums.meteor.com

dr-dimitru commented 5 years ago

Hey @vpl-webteam 👋 Have you found a solution so far?

dr-dimitru commented 2 years ago

Cleaning up here. Feel free to reopen it in case if the issue is still persists on your end.