This is how the Octave of Corpus Christi led to the feast of the Sacred Heart

During the 13th century, a Belgian nun by name Juliana of Liege told the Church leadership to institute a feast in honor of the Most Blessed Sacrament on the Thursday that follows the Trinity Sunday.
Eventually, the feast of Corpus Christi was established as a universal feast by 1264, and it was immediately after the feast was given an “octave,” which means that the spiritual themes celebrated on Corpus Christi would remain the primary focus of liturgy of the Church for a total of eight days.
This became a case for many centuries, and in the 17th century, St. Margaret Mary Alocque had a private vision where Jesus revealed his heart to her and said, “I ask thee that the first Friday after the octave of Corpus Christi be set apart as a special feast to honor My Heart.”
It is also recorded that she had this vision during an Eucharistic adoration, with the Blessed Sacrament exposed on the altar.
Though this wasn’t completely fulfilled until in the year 1856 when Pope Pius IX instituted the feast of the Sacred Heart on the universal Roman calendar, fixing it on the day that follows the octave of Corpus Christi.
The feast of the Sacred Heart however, remains on this day, even though the octave of Corpus Christi is no longer celebrated, and the Solemnity of Corpus Christi is moved to the Sunday after Trinity Sunday in the United States.
It is so fitting that the Church would have to meditate on the gift of the Blessed Sacrament for eight days, in that way, preparing oneself spiritually to honor the Heart of Jesus.
The both are deeply linked, as an article on Catholic Exchange states it, “The devotions to the Sacred Heart and to the Eucharist are intimately connected. They call upon one another or, we may even say, they need each other.
The Sacred Heart gives an explanation to the mystery of the love of Jesus by which He becomes bread in order to nourish us with His substance, while in the Eucharist we have in full the real presence of this same Heart, that lives in our midst.
It is so wonderful to consider the Heart of Jesus as the symbol of His infinite love, but it is even more wonderful to see Him always close to us in the Sacrament of the altar.
Jesus Christ himself asked St. Margaret Mary to always promote both the feast of the Sacred Heart and Eucharistic adoration, making the connection very clear.
Because, it is in the Eucharistic host that we can find the Heart of Jesus, beating and pouring out itself upon us.
It is never a coincidence that the feast of the Sacred Heart falls so close to the feast of Corpus Christi, because naturally, the celebration of one leads to the other.