Skip to content

Bug: Text field integer is being rounded and displaying incorrectly #6070

@bkuhl

Description

@bkuhl
  • Laravel Version: 10.32.1
  • Nova Version: 4.31.3
  • PHP Version: 8.2.3
  • Database Driver & Version: MySQL 8.0.28
  • Operating System and Version: #.#
  • Browser type and version: Chrome Version 119.0.6045.159 (Official Build) (arm64)
  • Reproduction Repository: https://github.com/###/###

Description:

I've noticed when displaying large numbers as Text that the numbers are being altered somewhere in the frontend Javascript leading to incorrect values being displayed. Searching a resource by this number and updating the value for this number via a form are saved correctly, it seems to only be a display issue.

Detailed steps to reproduce the issue on a fresh Nova installation:

  1. Create a table with the following structure:
CREATE TABLE `channel_subscriptions` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `platform_thread_id` bigint unsigned DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
  1. Create a nova resource for this table with the field:
Text::make('Platform Thread Id','platform_thread_id'),
  1. Add a record to the table with platform_thread_id set to value 1120706941212172299.

Showing the resource on Nova displays the number as 1120706941212172300 which is incorrect. I handle this as a Text field in Nova expecting that it would avoid any Javascript rounding issues. This incorrect number also shows when editing the resource from a relation (as shown below). Re-entering the correct value and saving this form saves the correct value.

Screenshot 2023-11-28 at 9 29 02 AM

As well as when showing the resource via an index page (again using it as a Text field):

Screenshot 2023-11-28 at 9 30 02 AM

I can also see in the ajax requesting loading the data that it's actually loading the correct value, so the value appears to be altered somewhere in the frontend JS before it's displayed:

Screenshot 2023-11-28 at 9 31 17 AM

screenshot taken from ajax request /nova-api/channel-subscriptions?search=Channel&filters=W3siQXBwXFxOb3ZhXFxGaWx0ZXJzXFxDaGFubmVsU3Vic2NyaXB0aW9uc1xcQnlDYXRlZ29yeSI6IiJ9LHsiQXBwXFxOb3ZhXFxGaWx0ZXJzXFxDaGFubmVsU3Vic2NyaXB0aW9uc1xcQnlDaGFubmVsVHlwZSI6IiJ9XQ%3D%3D&orderBy=&perPage=15&trashed=&page=1&viaResource=server&viaResourceId=875707&viaRelationship=channelSubscriptions&relationshipType=hasMany

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions