Reference links don't seem work in Slidy presentations when they are a different page or referencing a section

Here is a minimal example that reproduces the problem.

The problems are that when you knit this as slidy_presentation2, the hyperlink to Eq (1) and Theorem 1, doesn't work on the first page, but does work on the second page, because the equation and theorem is on the second page, but not the first. And the reference to the second page (secname) doesn't work anywhere, it appears as ??.

But if you knit this as html_document2. Everything works.

Is there a way to fix this?

(Replace \``` with ``` )

---
title: Refs dont work

output:
  bookdown::slidy_presentation2: default
  bookdown::html_document2: default
---

## First page

Equation reference is \@ref(eq:ff). Theorem reference is \@ref(thm:prob). Section
reference is \@ref(secname)


## Second page  {#secname}

\begin{equation}
  f(x) = x+1 (\#eq:ff)
\end{equation}

\```{theorem prob}
My theorem is $P(A)=1/2$.
\```

\```{r}
matrix(1:50,c(50,1))
\```

Equation reference is \@ref(eq:ff). Theorem reference is \@ref(thm:prob). Section
reference is \@ref(secname)

It is possible that bookdown feature don't work well with slidy_presentation(). This format is special and it may have not be fully tested with bookdown.

You can open an issue in bookdown so that it is tracked.

I don't know when and if this could be fixed.