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

[Tags] Incorrect sub-tags ordering in Chrome #325

Closed
tobyzerner opened this issue Aug 29, 2015 · 22 comments
Closed

[Tags] Incorrect sub-tags ordering in Chrome #325

tobyzerner opened this issue Aug 29, 2015 · 22 comments
Labels
Milestone

Comments

@tobyzerner
Copy link
Contributor

From @tobscure on August 28, 2015 2:56

From @tarunmarkose on August 20, 2015 7:37

The "Installation" subtag of "Support" on the demo site opens wrongly under "Dev". This happens for me while using Chrome. Firefox and Safari, are fine.

screenshot 2015-08-20 13 04 05

Copied from original issue: #239

Copied from original issue: flarum/tags#17

@tobyzerner
Copy link
Contributor Author

From @tarunmarkose on August 27, 2015 8:26

Hey, @tobscure if you are not fixing this before the beta release, I and my colleague @ishanAhuja could try and take care of it. Let me know.

@tobyzerner
Copy link
Contributor Author

Go for it! Relevant file is js/lib/utils/sortTags in the flarum/tags repo.

@tobyzerner tobyzerner changed the title Sub-tags bug in chrome [Tags] Incorrect sub-tags ordering in Chrome Aug 29, 2015
@ishanAhuja
Copy link

I'm unable to reproduce this issue. Has it been fixed?

@tobyzerner
Copy link
Contributor Author

No, I can still reproduce in Chrome 44.

@tarunmarkose
Copy link

@tobscure Seems like something fixed the issue.. if you can still reproduce the error, please outline here..

screenshot 2015-08-30 13 43 23

@tarunmarkose
Copy link

I am on Chrome 44.0.2403.157.

@tobyzerner
Copy link
Contributor Author

And seems to be fixed for me now too! That's weird, but sure, I'll take it :)

@tobyzerner
Copy link
Contributor Author

I think there might be more to the issue – like the number of other tags are present. We need to come up with a solid reproduction method.

@tarunmarkose
Copy link

True dat, @maxyc's issue seems like the same problem.
Even and odd number of tags is the first thing that comes to mind.
Alright, lets figure this out! I and @ishanAhuja will first work on reproducing the error today.

@maxyc Is there anything you can add to this thread to help us reproduce the error?
Can you take a screenshot of your tags administration page and put it up here so we can recreate it at our end?

@tarunmarkose
Copy link

@maxyc An export of your tags table, taken when the problem occurs would also be helpful.

@maxyc
Copy link

maxyc commented Aug 31, 2015

ok, on mobile error too

@maxyc
Copy link

maxyc commented Aug 31, 2015

error here http://novour.ru/t/Hobby
1

@maxyc
Copy link

maxyc commented Aug 31, 2015

http://novour.ru/sxd/backup/maxyc_novour_2015-08-31_10-46-44.sql.gz db table without users table

@tarunmarkose
Copy link

Thank you! I was able to recreate the issue. Will report back soon.

-Tarun

On Mon, Aug 31, 2015 at 1:17 PM, Максим [email protected] wrote:

http://novour.ru/sxd/backup/maxyc_novour_2015-08-31_10-46-44.sql.gz db
table without users table


Reply to this email directly or view it on GitHub
#325 (comment).

@tobyzerner tobyzerner mentioned this issue Sep 1, 2015
@tobyzerner
Copy link
Contributor Author

Since I added a new sub-tag, this can now be reliably reproduced on discuss.flarum.org now.

@ishanAhuja
Copy link

It seems that sortTags(tags) (js/lib/utils/sortTags) is giving differently ordered arrays in Chrome and Safari. Consequently the tags are ordered differently on Chrome and Safari. Any insights on what may be the cause?

@tobyzerner
Copy link
Contributor Author

It's due to a flaw in our sorting algorithm, so it ends up relying on the browser's sorting algorithm which varies between browsers. We need to fix our sorting algorithm.

@ishanAhuja
Copy link

I see. I'll take a stab at redoing the sortTags function.
If you could provide a sample set of tags passed to sortTags and the expected output (including orphan tags), it would be very helpful. Thanks.

@tobyzerner
Copy link
Contributor Author

The algorithm should basically result in this:

  1. Tags where position !== null, ordered by position ascending.
    • Tags with a parent should immediately follow it. Tags with the same parent should be ordered by position ascending.
  2. Tags where position === null, ordered by discussionsCount descending.

So given the tags:

id name position parent_id discussions_count
1 other 4 null 10
2 ux 2 null 13
3 dev 3 null 14
4 blog 1 null 1
5 i18n 2 3 7
6 extensibility 0 3 3
7 theming 1 3 1
8 likes null null 7
9 tags null null 19
10 sticky null null 2

We should end up with:

  1. blog
  2. ux
  3. dev
  4. extensibility
  5. theming
  6. i18n
  7. other
  8. tags
  9. likes
  10. sticky

The current implementation of the algorithm is almost there, there's just something slightly wrong with it.

@ishanAhuja
Copy link

Thanks Toby, I'll get on it.

On 04-Sep-2015, at 5:59 pm, Toby Zerner [email protected] wrote:

The algorithm should basically result in this:

Tags where position !== null, ordered by position ascending.
Tags with a parent should immediately follow it. Tags with the same parent should be ordered by position ascending.
Tags where position === null, ordered by discussionsCount descending.
So given the tags:

id name position parent_id discussions_count
1 other 4 null 10
2 ux 2 null 13
3 dev 3 null 14
4 blog 1 null 1
5 i18n 2 3 7
6 extensibility 0 3 3
7 theming 1 3 1
8 likes null null 7
9 tags null null 19
10 sticky null null 2
We should end up with:

blog
ux
dev
extensibility
theming
i18n
other
tags
likes
sticky

Reply to this email directly or view it on GitHub.

@franzliedke franzliedke added this to the 0.1.0-beta.3 milestone Sep 12, 2015
@ishanAhuja
Copy link

I've been pretty caught up at work, with a new release coming up for our product. If anyone else is willing to take a shot at this and contribute a fix, please go right ahead.

On 04-Sep-2015, at 6:28 PM, Ishan Ahuja [email protected] wrote:

Thanks Toby, I'll get on it.

On 04-Sep-2015, at 5:59 pm, Toby Zerner [email protected] wrote:

The algorithm should basically result in this:

Tags where position !== null, ordered by position ascending.
Tags with a parent should immediately follow it. Tags with the same parent should be ordered by position ascending.
Tags where position === null, ordered by discussionsCount descending.
So given the tags:

id name position parent_id discussions_count
1 other 4 null 10
2 ux 2 null 13
3 dev 3 null 14
4 blog 1 null 1
5 i18n 2 3 7
6 extensibility 0 3 3
7 theming 1 3 1
8 likes null null 7
9 tags null null 19
10 sticky null null 2
We should end up with:

blog
ux
dev
extensibility
theming
i18n
other
tags
likes
sticky

Reply to this email directly or view it on GitHub.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants