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

Fix a problem when sequential doesn't work without second argument in back function #104

Merged
merged 1 commit into from
Jan 12, 2024

Conversation

bedryck
Copy link
Contributor

@bedryck bedryck commented Jan 11, 2024

When we call monarch.back({ sequential = true }) sequential doesn't have any effect because we set options = nil if we don't have second and third parameters.

My changes have not broken something. Because we don't pass the option argument and we have strict condition options and options.sequential

@britzl
Copy link
Owner

britzl commented Jan 11, 2024

Nicely spotted! I would be ok with removing that backwards compatibility fix and introduce a breaking change. Trying to fix up arguments from previous versions is a hassle. What are your thoughts on this?

@bedryck
Copy link
Contributor Author

bedryck commented Jan 11, 2024

Of course, removing that backwards compatibility fix is a more cleaner solution. It will also make this method more uniform and similar to other monarch methods.

As for the fact that it is breaking change. It will not affect my project at all, I use the monarch from the version when the back expects the options as the first argument)
As for other projects, in my opinion, this will not require a lot of changes, and most developers usually use back without arguments, because players usually just go back without additional data.

By the way, my changes should work for both cases:
Example If somebody calls back with data: back({ data })
we just set data = options
If somebody calls back with options: back({ options })
options still have the same value.

Whatever the solution is I just wanted to draw attention to a small problem

@britzl
Copy link
Owner

britzl commented Jan 12, 2024

Let's start by merging your change! Thanks!

@britzl britzl merged commit 00c3079 into britzl:master Jan 12, 2024
@britzl
Copy link
Owner

britzl commented Jan 12, 2024

After looking at the code I actually decided to remove the backward compatibility fix.

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

Successfully merging this pull request may close these issues.

2 participants